sorooshmani-noaa / ocsmeshtutorial Goto Github PK
View Code? Open in Web Editor NEWThis repository stores files and documentation used for OCSMesh tutorial Sessions
License: Creative Commons Zero v1.0 Universal
This repository stores files and documentation used for OCSMesh tutorial Sessions
License: Creative Commons Zero v1.0 Universal
Before instructions for jigsaw installation please add notes regarding required modules:
Also, the link for downloading test case should work as:
(?dl=1 is not needed I believe).
I get an error (pasted below) running any of the code blocks that includes ocsmesh.Hfun function, for example, the following in the toturial:
hfun_obj_4 = ocsmesh.Hfun(rasters[3], hmin=1000, hmax=5000)
hfun_msh_t_4 = hfun_obj_4.msh_t()
And here is the error:
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
Cell In[28], line 2
1 hfun_obj_4 = ocsmesh.Hfun(rasters[3], hmin=1000, hmax=5000)
----> 2 hfun_msh_t_4 = hfun_obj_4.msh_t()
File /scratch2/STI/coastal/save/Bahram.Khazaei/env/miniconda3/envs/myenv/lib/python3.10/site-packages/ocsmesh/hfun/raster.py:465, in HfunRaster.msh_t(self, window, marche, verbosity)
462 if marche is True:
463 libsaw.marche(opts, hfun)
--> 465 libsaw.jigsaw(opts, geom, window_mesh, hfun=hfun)
467 del geom
468 # do post processing
File /scratch2/STI/coastal/save/Bahram.Khazaei/env/miniconda3/envs/myenv/lib/python3.10/site-packages/jigsawpy/libsaw.py:746, in jigsaw(opts, geom, mesh, init, hfun)
740 retv = JLIB.jigsaw(ct.byref(ojig),
741 ct.byref(gmsh),
742 iptr, hptr,
743 ct.byref(mmsh))
745 if (retv != +0):
--> 746 raise Exception(
747 "JIGSAW returned code: " + str(retv))
749 #--------------------------------- copy buffers to MSH_t
751 get_msh_t(mesh, mmsh)
Exception: JIGSAW returned code: 4
Follow up on (emphasis mine):
I have downloaded WSL and tried it out on my laptop. This does fix an issue relating to saving a mesh (I still experience a permission denied error when attempting to save a mesh outside the main home folder, but that's not a big issue), and the remaining issues I have with OCSMesh involve the amount of memory available on my laptop. The main memory-intensive parts of the tutorial provided seem to be refining the size function with NWM river shapes and the
geom.get_multipolygon
command applied to the gebco file. How much memory needs to be allocated in order for the notebook to successfully run these parts of the code? Also, in Frontera/TACC, do you know how I would be able to effectively use multiple compute nodes for mesh generation? Using a single compute node results in the notebook running out of memory when refining the size function with NWM river shapes. Meanwhile, running out of memory usinggeom.get_multipolygon
is only an issue when using WSL on my laptop. For reference, my laptop has 16GB of memory and the WSL has 8GB allocated to it.
More specifically the main questions to address are:
How much memory needs to be allocated in order for the notebook to successfully run
and
how I would be able to effectively use multiple compute nodes
In the first block of code importing the modules I got this error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[1], line 21
18 import xarray as xr
19 from rasterio.plot import show as rioshow
---> 21 import ocsmesh
22 import pyschism
23 import pyschism.driver
File ~\AppData\Local\anaconda3\envs\simulation\Lib\site-packages\ocsmesh\__init__.py:10
6 import platform
9 try:
---> 10 import jigsawpy # noqa: F401
11 except OSError as e:
12 pkg = util.find_spec("jigsawpy")
File ~\AppData\Local\anaconda3\envs\simulation\Lib\site-packages\jigsawpy\__init__.py:58
55 from jigsawpy.def_t import jigsaw_def_t
56 from jigsawpy.prj_t import jigsaw_prj_t
---> 58 from jigsawpy import jigsaw, libsaw
60 from jigsawpy.loadmsh import loadmsh
61 from jigsawpy.savemsh import savemsh
File ~\AppData\Local\anaconda3\envs\simulation\Lib\site-packages\jigsawpy\libsaw.py:65
62 if (JLIBNAME == Path()):
63 #---------------------------- search machine path for binary
64 if (platform.system() == WIN):
---> 65 JLIBNAME = Path(
66 ctypes.util.find_library("jigsaw.dll"))
68 elif (platform.system() == LNX):
69 JLIBNAME = Path("libjigsaw.so")
File ~\AppData\Local\anaconda3\envs\simulation\Lib\pathlib.py:871, in Path.__new__(cls, *args, **kwargs)
869 if cls is Path:
870 cls = WindowsPath if os.name == 'nt' else PosixPath
--> 871 self = cls._from_parts(args)
872 if not self._flavour.is_supported:
873 raise NotImplementedError("cannot instantiate %r on your system"
874 % (cls.__name__,))
File ~\AppData\Local\anaconda3\envs\simulation\Lib\pathlib.py:509, in PurePath._from_parts(cls, args)
504 @classmethod
505 def _from_parts(cls, args):
506 # We need to call _parse_args on the instance, so as to get the
507 # right flavour.
508 self = object.__new__(cls)
--> 509 drv, root, parts = self._parse_args(args)
510 self._drv = drv
511 self._root = root
File ~\AppData\Local\anaconda3\envs\simulation\Lib\pathlib.py:493, in PurePath._parse_args(cls, args)
491 parts += a._parts
492 else:
--> 493 a = os.fspath(a)
494 if isinstance(a, str):
495 # Force-cast str subclasses to str (issue #21127)
496 parts.append(str(a))
TypeError: expected str, bytes or os.PathLike object, not NoneType
I think it may be something to do with the jigsawpy module but I'm not sure. I'm using the simulation virtual environment that was created for this tutorial, and the files are in the tmp folder that was also created. I was trying to run this in a Jupyter notebook for which the kernel I used was for the simulation virtual environment.
I'm still a bit new to working with virtual environments and the nuances of anaconda so I appreciate the help!
Not sure if this was resolved yet somewhere else, but when going through the tutorial I ran into an issue while trying to adjust the mesh after making local modifications. There was a warning in the tutorial about iteration over multi-part geometries being deprecated with shapely 2.0. I got an error when running this chunk of code:
hfun_obj_3.add_patch(
test_polygon_1,
expansion_rate=0.001,
target_size=300
)
that 'MultiPolygon' object is not iterable. Is there a way to adjust the code to fix this?
Thank you!
@SorooshMani-NOAA and @yunfangsun I am running the Validation_Ian.ipynb standalone and getting an error for missing modules
ModuleNotFoundError Traceback (most recent call last)
Cell In[2], line 5
1 PathToMyFunctions = Path('.').absolute() / 'utility'
3 sys.path.append(str(PathToMyFunctions))
----> 5 from SchismFunctions import read_SchismWaterElevation2D
6 from SchismFunctions import read_ObservedWaterLevel
7 from PythonFunctions import find_indices2D
ModuleNotFoundError: No module named 'SchismFunctions'
I also see some paths in the next cells (i.e. Path_pahmc = workdir / 'pahmc/outputs'
) that I don't have either. Can you please help me to resolve these issues?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.