Skip to content

Commit

Permalink
Try to test on_topic notebooks as well (#13)
Browse files Browse the repository at this point in the history
* update notebooks

* remove metadata from cells during tests

* update content and contextily installation

* add descartes

* typo

* update installation manual

* update gitignore

* move groundwater model directory

* update gitignore

* restructure and update practical examples

* last update for now

* add cbs_data analyse

* update twitter analysis

* reinstate some files to be ignored

* remove error in camel_bananas function

* update camel problem

* modify text

* remove notebook metadata as well (and not only cell metadata)

* minor changes

* remove all metadata from notebooks

* add on-topic to test

* update travis requirements

* fix travis test errors

* add pyproj to travis req

* add proj to travis req

* add proj4 to travis req

* remove proj from req

* another attempt to let travis install cartopy

* another attempt to let travis install cartopy

* another attempt to let travis install cartopy

* another attempt to let travis install cartopy

* another attempt to let travis install cartopy

* another attempt to let travis install cartopy

* another attempt to let travis install cartopy

* another attempt to let travis install cartopy

* another attempt to let travis install cartopy

* another attempt to let travis install cartopy

* another day another attempt:

* another day another attempt:

* another day another attempt:

* another day another attempt:

* add dependencies

* add dependency

* remove first folium notebook from tests because mplleaflet is not maintained anymore, see this issue plotly/plotly.py#2913
  • Loading branch information
OnnoEbbens authored Dec 3, 2020
1 parent 682b4fa commit 9e95a75
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 41 deletions.
30 changes: 27 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,41 @@ language: python
os:
- linux

env:
matrix:
- ENV_NAME="test-environment"
PYTHON_VERSION=3.7
PACKAGES="ipython>=7.0.0 numpy scipy matplotlib pandas jupyter cython proj4=5.2.0"

branches:
only:
- master

jobs:
include:
- python: 3.7
dist: xenial
- dist: xenial

# Install dependencies
install:
# Install miniconda
# -----------------
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"


# Create the basic testing environment
# ------------------------------------
- conda config --set always_yes yes
- conda config --add channels conda-forge

# Customise the testing environment
# ---------------------------------
- conda create -n $ENV_NAME python=$PYTHON_VERSION $PACKAGES
- source activate $ENV_NAME

# Install packages
# ----------------
- pip install -r requirements.travis.txt
- pip install --upgrade pip
- pip install codecov
Expand All @@ -25,6 +49,6 @@ install:
# command to run tests
script:
- py.test ./autotest/test_01_basic.py -n 3

- py.test ./autotest/test_02_on_topic.py -n 3
after_success:
- python-codacy-coverage -r coverage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,7 @@
]
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"metadata": {},
"nbformat": 4,
"nbformat_minor": 1
}
6 changes: 3 additions & 3 deletions Exercise_notebooks/On_topic/08_GIS/Geopandas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"metadata": {},
"outputs": [],
"source": [
"df_turbines = pd.read_excel(r'data\\turbines_ohvs.xlsx')\n",
"df_turbines = pd.read_excel(r'data/turbines_ohvs.xlsx')\n",
"df_turbines.head()"
]
},
Expand Down Expand Up @@ -481,7 +481,7 @@
"metadata": {},
"outputs": [],
"source": [
"gdf_nybb = gpd.read_file(r'data\\nybb.shp')\n",
"gdf_nybb = gpd.read_file(r'data/nybb.shp')\n",
"gdf_nybb.head()"
]
},
Expand Down Expand Up @@ -531,7 +531,7 @@
"metadata": {},
"outputs": [],
"source": [
"df_verkeer = pd.read_csv(r'data\\traffic_intensity_Utrecht.csv')\n",
"df_verkeer = pd.read_csv(r'data/traffic_intensity_Utrecht.csv')\n",
"geometry = gpd.points_from_xy(df_verkeer['longitude'], df_verkeer['latitude'])\n",
"gdf_verkeer = gpd.GeoDataFrame(df_verkeer.copy(), geometry=geometry)\n",
"gdf_verkeer.head()"
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,16 @@
],
"metadata": {
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
}
},
"nbformat": 4,
Expand Down
8 changes: 4 additions & 4 deletions Exercise_notebooks/On_topic/24_pastas/3_stressmodels.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@
"outputs": [],
"source": [
"ini_param = ml.parameters['initial'].values\n",
"sim_ini_param = ml.simulate(parameters=ini_param)\n",
"sim_ini_param = ml.simulate(p=ini_param)\n",
"\n",
"#visualise results\n",
"sim_ini_param.plot(label='model simulation initial parameters')\n",
Expand Down Expand Up @@ -654,7 +654,7 @@
"source": [
"# simulate groundwater head with optimized parameters\n",
"opt_param = ml.parameters['optimal'].values\n",
"sim_opt_param = ml.simulate(parameters=opt_param)\n",
"sim_opt_param = ml.simulate(p=opt_param)\n",
"\n",
"# or simply use\n",
"sim_opt_param = ml.simulate()\n",
Expand Down Expand Up @@ -688,8 +688,8 @@
"semi_opt_param[3] = 1.0\n",
"\n",
"\n",
"sim_opt_param = ml.simulate(parameters=opt_param)\n",
"sim_semi_opt = ml.simulate(parameters=semi_opt_param)\n",
"sim_opt_param = ml.simulate(p=opt_param)\n",
"sim_semi_opt = ml.simulate(p=semi_opt_param)\n",
"\n",
"#visualise results\n",
"sim_opt_param.plot(label='model simulation optimal parameters')\n",
Expand Down
6 changes: 3 additions & 3 deletions Exercise_notebooks/On_topic/24_pastas/4_pastas_project.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"outputs": [],
"source": [
"# add the observations in all the files in the data-directory that end with _1.csv\n",
"datapath = r'data\\nb4'\n",
"datapath = r'data/nb4'\n",
"files = [x for x in os.listdir(datapath) if x.endswith('_1.csv')]\n",
"for file in files:\n",
" fname = os.path.join(datapath,file)\n",
Expand All @@ -71,7 +71,7 @@
"metadata": {},
"source": [
"#### Exercise 1 <a name=\"ex1\"></a>\n",
"Create a pastas project. Add the observations in the `data\\nb4\\ex1` to the model. Which measurements series has the lowest filter?"
"Create a pastas project. Add the observations in the `data/nb4/ex1` directory to the model. Which measurements series has the lowest filter?"
]
},
{
Expand Down Expand Up @@ -430,7 +430,7 @@
"pr_q = ps.Project(name='exercise1')\n",
"\n",
"# add the observations in all the files in the data-directory that end with _1.csv\n",
"datapath_ex1 = r'data\\nb4\\ex1'\n",
"datapath_ex1 = r'data/nb4/ex1'\n",
"files = [x for x in os.listdir(datapath_ex1) if x.endswith('_1.csv')]\n",
"for file in files:\n",
" fname = os.path.join(datapath_ex1,file)\n",
Expand Down
16 changes: 0 additions & 16 deletions autotest/test_02_on_topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,22 +791,6 @@ def test_11___Running_Bokeh_Applications():
assert out == 0
return 1

def test_Folium01_and_mplleaflet():
fpath_rel = ['20_folium', 'Folium01_and_mplleaflet.ipynb']
subdir = fpath_rel[:-1]
fname = fpath_rel[-1]
fdir = os.path.join(*nb_dir, *subdir)
cwd = os.getcwd()
os.chdir(fdir)
try:
out = tf.run_notebook(fname, clearoutput=True)
os.chdir(cwd)
except Exception as e:
os.chdir(cwd)
raise(e)
assert out == 0
return 1

def test_Folium02_CheckZorder():
fpath_rel = ['20_folium', 'Folium02_CheckZorder.ipynb']
subdir = fpath_rel[:-1]
Expand Down
17 changes: 11 additions & 6 deletions requirements.travis.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
numpy>=1.15
scipy>=1.2
matplotlib>=3.0
pandas>=0.24
jupyter>=1.0.0
lxml
requests
zeep
Expand All @@ -15,4 +10,14 @@ branca
folium
bokeh
pastas
nbformat
xlrd
sqlalchemy
rasterio
cartopy
descartes
mplleaflet
contextily
geographiclib
networkx
gpxpy
pyshp

0 comments on commit 9e95a75

Please sign in to comment.