Open yosoyjay opened 2 years ago
Yeah, this is confusing and I was working on rewriting the docs and doing some renaming to make things more clear -- but I got stalled out.
First, the "GridCurrentMover" is deprecated. That calls old C++ code. That shouldn't be imported into the scripting name space anymore and has been renamed to c_GridCurrentMover to try to make it more obscure.
That leaves the newer version "PyCurrentMover". The newer Python movers are based on environment objects which can be created separated (that's what GridCurrent is). You can explicity create these environment objects (e.g. in the case you may want to create multiple movers or weatherers based on it). But in the typically case, you can just create the mover directly and the associated environment object will be created. The environment object contains the data (in this case velocity vectors and understands the grid and how to do interpolation to the particle position). So the "mover" can just ask the environment object for information at the particle location and then apply whatever algorithms are part of the mover.
So that's a lot of background. But to just add a NetCDF file as a current mover, you can do: import gnome.scripting as gs model = gs.Model() curr_mover = gs.PyCurrentMover.from_netCDF('file.nc') model.movers += curr_mover ...
Result from end-to-end.sh
Error:curl error: Error in the HTTP2 framing layer
curl error details:
Warning:oc_open: Could not read url
Running simulation
/Users/jesse/src/PyGnome/py_gnome/gnome/init.py:62: UserWarning: ERROR: The adios_db package, version >= 1.0.0 needs to be installed: Only required to use the ADIOS Database JSON format for oil data.
warnings.warn(msg)
/Users/jesse/mambaforge-x86/envs/gnome/lib/python3.8/site-packages/gridded/depth.py:507: RuntimeWarning: Unable to automatically determine depth system so reverting to surface-only mode. Please verify the index of the surface is correct.
warnings.warn('''Unable to automatically determine depth system so reverting to surface-only mode. Please verify the index of the surface is correct.''', RuntimeWarning)
Traceback (most recent call last):
File "simple_script.py", line 53, in
I tried to slightly change simple_script.py from PyGNOME to use a NetCDF file as a current source, but unfortunately I couldn't quite figure out the right method.
It looks like docs do not align with the PyGNOME installed from the main brach. There are lots of different options, but no clear one to use and the few that I tried(GridCurrentMover, GridCurrent, PyGridCurrentMover) failed due to import errors or
None
for some variable on the call tomodel.full_run()
.What's the canonical way to do this? @ChrisBarker-NOAA @AmyMacFadyen