Skip to content

Commit

Permalink
Merge pull request #179 from ec-jrc/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
pmav99 authored Apr 9, 2024
2 parents 7024f29 + ad6bf14 commit 02d950c
Show file tree
Hide file tree
Showing 26 changed files with 1,884 additions and 69 deletions.
4 changes: 2 additions & 2 deletions Tutorial/FORECAST.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
"source": [
"## Setup a (re)forecast\n",
"\n",
"Let's assume we have a forecasting cycle where new meteo forcings become available every `12H`."
"Let's assume we have a forecasting cycle where new meteo forcings become available every `12h`."
]
},
{
Expand All @@ -264,7 +264,7 @@
"# creating a time sequence of the runs\n",
"start_date = pd.to_datetime(\"2018-10-1 0:0:0\")\n",
"end_date = pd.to_datetime(\"2018-10-2 12:0:0\")\n",
"date_list = pd.date_range(start_date, end_date, freq=\"12H\")\n",
"date_list = pd.date_range(start_date, end_date, freq=\"12h\")\n",
"date_list"
]
},
Expand Down
2 changes: 1 addition & 1 deletion Tutorial/GSS.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"model={'solver_name':'schism',\n",
" 'mesh_file':'./test/global/hgrid.gr3',\n",
" 'start_date':'2011-01-1 0:0:0',\n",
" 'time_frame':'12H',\n",
" 'time_frame':'12h',\n",
" 'meteo_source' : ['./data/era5.grib'], #path to meteo files\n",
" 'dem_source' : './data/dem.nc', #path to dem file\n",
" 'rpath':'./test/global/schism/', #location of calc folder\n",
Expand Down
6 changes: 3 additions & 3 deletions Tutorial/HINDCAST.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
" 'coastlines':ne_i,\n",
" 'mesh_generator' : 'jigsaw', # set grid generator \n",
" 'start_date':'2011-01-1 0:0:0',\n",
" 'time_frame':'12H',\n",
" 'time_frame':'12h',\n",
" 'meteo_source' : './data/era5.grib', #path to meteo files\n",
" 'dem_source' : './data/dem.nc', #path to dem file\n",
" 'rpath':'./test/hindcast/20110101.00/', #location of calc folder\n",
Expand Down Expand Up @@ -258,7 +258,7 @@
"source": [
"## Setup a hindcast\n",
"\n",
"Let's assume we want to split the hindcast on a `12H` splits. Doing a hindcast doesn't, in general, entail overlaping meteo forcing. However when more than one meteo file is needed one needs to be consistent into aligning the dates accordingly. There is an extra argument that provides that functionality (see documentation). \n",
"Let's assume we want to split the hindcast on a `12h` splits. Doing a hindcast doesn't, in general, entail overlaping meteo forcing. However when more than one meteo file is needed one needs to be consistent into aligning the dates accordingly. There is an extra argument that provides that functionality (see documentation). \n",
"\n",
"We setup the hindcast process as"
]
Expand All @@ -285,7 +285,7 @@
"# creating a time sequence of the runs\n",
"start_date = pd.to_datetime(\"2011-1-1 0:0:0\")\n",
"end_date = pd.to_datetime(\"2011-1-2 0:0:0\")\n",
"date_list = pd.date_range(start_date, end_date, freq=\"12H\")\n",
"date_list = pd.date_range(start_date, end_date, freq=\"12h\")\n",
"date_list"
]
},
Expand Down
2 changes: 1 addition & 1 deletion Tutorial/MODEL.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
"# 'tag':'schism', # optional tag \n",
" 'mesh_generator' : 'jigsaw', # set mesh generator \n",
" 'start_date':'2017-10-1 0:0:0',\n",
" 'time_frame':'12H',\n",
" 'time_frame':'12h',\n",
" 'meteo_source' : ['./data/erai.grib'], #path to meteo files\n",
" 'dem_source' : './data/dem.nc', #path to dem file\n",
"# 'ncores': 4 , # optional number of cores\n",
Expand Down
2 changes: 1 addition & 1 deletion Tutorial/VALIDATION.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
" 'coastlines':ne_i, # coastlines\n",
" 'mesh_generator' : 'jigsaw', # set grid generator \n",
" 'start_date':'2017-10-1 0:0:0',\n",
" 'time_frame':'12H',\n",
" 'time_frame':'12h',\n",
" 'meteo_source' : './data/erai.grib', #path to meteo files\n",
" 'dem_source' : './data/dem.nc', #path to dem file\n",
" 'rpath':'./test/validation/', #location of calc folder\n",
Expand Down
12 changes: 6 additions & 6 deletions docs/model.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ A number of parameters is provided by the user :

- *solver_name*:
Select the solver to be used e.g. *schism*.
- *geometry*:
- *geometry*:
In the most simple case that is a lat/lon box that defines the area of interest.
- *coastlines*:
A coastlines *GeoDataFrame* or *shapefile* providing boundaries to the mesh.
A coastlines *GeoDataFrame* or *shapefile* providing boundaries to the mesh.
- *mesh_generator*:
Set the backend for creating a mesh e.g. `jigsaw`.
- *start_date*:
Expand All @@ -33,7 +33,7 @@ dic = {
"coastlines": "/path/to/coastal/shapefile.shp",
"mesh_generator": "jigsaw",
"start_date": "2017-10-1 0:0:0",
"time_frame": "12H",
"time_frame": "12h",
"meteo_source": ["/path/to/meteo/file.grib"],
"dem_source": "./path/to/dem/file.nc",
}
Expand Down Expand Up @@ -80,7 +80,7 @@ b.get_output_data() # integrate output
```

and the data are available as

```py
b.data.Dataset # output Dataset
```
Expand All @@ -94,12 +94,12 @@ If a model is created by `pyposeidon` there is a `json` file that describes the
a = pyposeidon.model.read('./path/to/schism_model.json')
a.execute() #execute it again
```

When a model is created by other means, it can still be incorporated into `pyposeidon` with

```py
c = pm.set(solver_name='schism', rfolder = './path/to/folder/',
load_mesh=True, load_meteo=True)
c.mesh.Dataset
c.meteo.Dataset
```
```
3 changes: 2 additions & 1 deletion locks/requirements-ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ importlib-metadata==7.1.0 ; python_version >= "3.9" and python_version < "3.12"
importlib-resources==6.4.0 ; python_version >= "3.9" and python_version < "4.0"
iniconfig==2.0.0 ; python_version >= "3.9" and python_version < "4"
jinja2==3.1.3 ; python_version >= "3.9" and python_version < "4"
joblib==1.3.2 ; python_version >= "3.9" and python_version < "4"
joblib==1.4.0 ; python_version >= "3.9" and python_version < "4"
kiwisolver==1.4.5 ; python_version >= "3.9" and python_version < "4"
limits==3.10.1 ; python_version >= "3.9" and python_version < "4.0"
llvmlite==0.42.0 ; python_version >= "3.9" and python_version < "4"
Expand All @@ -74,6 +74,7 @@ pydantic-core==2.16.3 ; python_version >= "3.9" and python_version < "4.0"
pydantic==2.6.4 ; python_version >= "3.9" and python_version < "4.0"
pydap==3.4.1 ; python_version >= "3.9" and python_version < "4"
pykdtree==1.3.11 ; python_version >= "3.9" and python_version < "4"
pyogrio==0.7.2 ; python_version >= "3.9" and python_version < "4"
pyparsing==3.1.2 ; python_version >= "3.9" and python_version < "4"
pyproj==3.6.1 ; python_version >= "3.9" and python_version < "4"
pyresample==1.28.2 ; python_version >= "3.9" and python_version < "4"
Expand Down
3 changes: 2 additions & 1 deletion locks/requirements-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ itk-numerics==5.3.0 ; python_version >= "3.9" and python_version < "4"
itkwidgets==0.32.6 ; python_version >= "3.9" and python_version < "4"
jedi==0.19.1 ; python_version >= "3.9" and python_version < "4"
jinja2==3.1.3 ; python_version >= "3.9" and python_version < "4"
joblib==1.3.2 ; python_version >= "3.9" and python_version < "4"
joblib==1.4.0 ; python_version >= "3.9" and python_version < "4"
jsonschema-specifications==2023.12.1 ; python_version >= "3.9" and python_version < "4"
jsonschema==4.21.1 ; python_version >= "3.9" and python_version < "4"
jupyter-client==8.6.1 ; python_version >= "3.9" and python_version < "4"
Expand Down Expand Up @@ -150,6 +150,7 @@ pyface==8.0.0 ; python_version >= "3.9" and python_version < "4"
pygments==2.17.2 ; python_version >= "3.9" and python_version < "4"
pykdtree==1.3.11 ; python_version >= "3.9" and python_version < "4"
pymdown-extensions==10.7.1 ; python_version >= "3.9" and python_version < "4"
pyogrio==0.7.2 ; python_version >= "3.9" and python_version < "4"
pyparsing==3.1.2 ; python_version >= "3.9" and python_version < "4"
pyproj==3.6.1 ; python_version >= "3.9" and python_version < "4"
pyresample==1.28.2 ; python_version >= "3.9" and python_version < "4"
Expand Down
5 changes: 2 additions & 3 deletions locks/requirements-viz.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ beautifulsoup4==4.12.3 ; python_version >= "3.9" and python_version < "4"
bleach==6.1.0 ; python_version >= "3.9" and python_version < "4"
bokeh==3.4.0 ; python_version >= "3.9" and python_version < "4"
cartopy==0.22.0 ; python_version >= "3.9" and python_version < "4"
catalogue==2.0.10 ; python_version >= "3.9" and python_version < "4"
certifi==2024.2.2 ; python_version >= "3.9" and python_version < "4"
cffi==1.16.0 ; python_version >= "3.9" and python_version < "4"
cfgrib==0.9.11.0 ; python_version >= "3.9" and python_version < "4"
Expand Down Expand Up @@ -75,7 +74,7 @@ itk-numerics==5.3.0 ; python_version >= "3.9" and python_version < "4"
itkwidgets==0.32.6 ; python_version >= "3.9" and python_version < "4"
jedi==0.19.1 ; python_version >= "3.9" and python_version < "4"
jinja2==3.1.3 ; python_version >= "3.9" and python_version < "4"
joblib==1.3.2 ; python_version >= "3.9" and python_version < "4"
joblib==1.4.0 ; python_version >= "3.9" and python_version < "4"
jsonschema-specifications==2023.12.1 ; python_version >= "3.9" and python_version < "4"
jsonschema==4.21.1 ; python_version >= "3.9" and python_version < "4"
jupyter-client==8.6.1 ; python_version >= "3.9" and python_version < "4"
Expand Down Expand Up @@ -132,6 +131,7 @@ pydap==3.4.1 ; python_version >= "3.9" and python_version < "4"
pyface==8.0.0 ; python_version >= "3.9" and python_version < "4"
pygments==2.17.2 ; python_version >= "3.9" and python_version < "4"
pykdtree==1.3.11 ; python_version >= "3.9" and python_version < "4"
pyogrio==0.7.2 ; python_version >= "3.9" and python_version < "4"
pyparsing==3.1.2 ; python_version >= "3.9" and python_version < "4"
pyproj==3.6.1 ; python_version >= "3.9" and python_version < "4"
pyresample==1.28.2 ; python_version >= "3.9" and python_version < "4"
Expand Down Expand Up @@ -159,7 +159,6 @@ sniffio==1.3.1 ; python_version >= "3.9" and python_version < "4.0"
snuggs==1.4.7 ; python_version >= "3.9" and python_version < "4"
soupsieve==2.5 ; python_version >= "3.9" and python_version < "4"
spatialpandas==0.4.10 ; python_version >= "3.9" and python_version < "4"
srsly==2.4.8 ; python_version >= "3.9" and python_version < "4"
stack-data==0.6.3 ; python_version >= "3.9" and python_version < "4"
terminado==0.18.1 ; python_version >= "3.9" and python_version < "4"
tinycss2==1.2.1 ; python_version >= "3.9" and python_version < "4"
Expand Down
5 changes: 2 additions & 3 deletions locks/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ asciitree==0.3.3 ; python_version >= "3.9" and python_version < "4"
attrs==23.2.0 ; python_version >= "3.9" and python_version < "4"
beautifulsoup4==4.12.3 ; python_version >= "3.9" and python_version < "4"
cartopy==0.22.0 ; python_version >= "3.9" and python_version < "4"
catalogue==2.0.10 ; python_version >= "3.9" and python_version < "4"
certifi==2024.2.2 ; python_version >= "3.9" and python_version < "4"
cffi==1.16.0 ; python_version >= "3.9" and python_version < "4"
cfgrib==0.9.11.0 ; python_version >= "3.9" and python_version < "4"
Expand Down Expand Up @@ -44,7 +43,7 @@ idna==3.6 ; python_version >= "3.9" and python_version < "4"
importlib-metadata==7.1.0 ; python_version >= "3.9" and python_version < "3.12"
importlib-resources==6.4.0 ; python_version >= "3.9" and python_version < "4.0"
jinja2==3.1.3 ; python_version >= "3.9" and python_version < "4"
joblib==1.3.2 ; python_version >= "3.9" and python_version < "4"
joblib==1.4.0 ; python_version >= "3.9" and python_version < "4"
kiwisolver==1.4.5 ; python_version >= "3.9" and python_version < "4"
limits==3.10.1 ; python_version >= "3.9" and python_version < "4.0"
llvmlite==0.42.0 ; python_version >= "3.9" and python_version < "4"
Expand All @@ -66,6 +65,7 @@ pydantic-core==2.16.3 ; python_version >= "3.9" and python_version < "4.0"
pydantic==2.6.4 ; python_version >= "3.9" and python_version < "4.0"
pydap==3.4.1 ; python_version >= "3.9" and python_version < "4"
pykdtree==1.3.11 ; python_version >= "3.9" and python_version < "4"
pyogrio==0.7.2 ; python_version >= "3.9" and python_version < "4"
pyparsing==3.1.2 ; python_version >= "3.9" and python_version < "4"
pyproj==3.6.1 ; python_version >= "3.9" and python_version < "4"
pyresample==1.28.2 ; python_version >= "3.9" and python_version < "4"
Expand All @@ -84,7 +84,6 @@ six==1.16.0 ; python_version >= "3.9" and python_version < "4"
sniffio==1.3.1 ; python_version >= "3.9" and python_version < "4.0"
snuggs==1.4.7 ; python_version >= "3.9" and python_version < "4"
soupsieve==2.5 ; python_version >= "3.9" and python_version < "4"
srsly==2.4.8 ; python_version >= "3.9" and python_version < "4"
toolz==0.12.1 ; python_version >= "3.9" and python_version < "4"
tqdm==4.66.2 ; python_version >= "3.9" and python_version < "4"
typing-extensions==4.11.0 ; python_version >= "3.9" and python_version < "4.0"
Expand Down
55 changes: 50 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pyposeidon/mgmsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import os
from tqdm.auto import tqdm
import sys
import gmsh
import subprocess
import shapely
import shlex
Expand Down Expand Up @@ -67,6 +66,8 @@ def get_ibounds(df, mm):


def read_msh(filename, **kwargs):
import gmsh

model = gmsh.model
factory = model.geo

Expand Down Expand Up @@ -800,6 +801,8 @@ def make_bgmesh(df, fpos, **kwargs):


def make_gmsh(df, **kwargs):
import gmsh

logger.info("Creating mesh")

model = gmsh.model
Expand Down Expand Up @@ -1006,6 +1009,8 @@ def make_gmsh(df, **kwargs):


def make_gmsh_3d(df, **kwargs):
import gmsh

logger.info("Creating global mesh")

model = gmsh.model
Expand Down
Loading

0 comments on commit 02d950c

Please sign in to comment.