Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't load GridCurrent #135

Open
gab1092 opened this issue Nov 7, 2022 · 3 comments
Open

Can't load GridCurrent #135

gab1092 opened this issue Nov 7, 2022 · 3 comments

Comments

@gab1092
Copy link

gab1092 commented Nov 7, 2022

Hello! I can't load the module GridCurrentMover, I install pygnome a few days ago, with the new instalation I can't use GridCurrentMover the error is as follows, somebody can help me please?

from gnome.movers import GridCurrentMover

from gnome.movers import GridCurrent
Traceback (most recent call last):

File "/tmp/ipykernel_711923/1284827270.py", line 1, in <cell line: 1>
from gnome.movers import GridCurrent

ImportError: cannot import name 'GridCurrent' from 'gnome.movers' (/home/gabriela/PyGnome/py_gnome/gnome/movers/init.py)

@coconnor8
Copy link
Contributor

coconnor8 commented Nov 8, 2022 via email

@ChrisBarker-NOAA
Copy link
Contributor

Also note that you are having trouble importing GridCurrent from the Movers module -- but GridCurrent is not a mover, so not there. Most of the time you don't need to work directly with the GridCurrent -- you can probably simply use the Mover.

Also, we have made it a bit easier t find all these object by putting them in the "scripting" namespace, so you can do:

import gnome.scripting as gs

mover = gs.PyGridCurrentMover(....)

See:
https://gnome.orr.noaa.gov/doc/pygnome/scripting/index.html

(not complete but it should be helpful)

@gab1092
Copy link
Author

gab1092 commented Nov 16, 2022

Thank you for your help! I am able to load only a file but when I try to load multiple files from a python list of files I receive the following error:

from gnome.movers import PyCurrentMover, PyWindMover

c_mover=PyCurrentMover.from_netCDF(files[0:20])
model.movers += c_mover
Traceback (most recent call last):

File "/tmp/ipykernel_1593959/2237426380.py", line 1, in <cell line: 1>
c_mover=PyCurrentMover.from_netCDF(files[0:20])

File "/home/gabriela/PyGnome/py_gnome/gnome/movers/py_current_movers.py", line 141, in from_netCDF
current = GridCurrent.from_netCDF(filename, **kwargs)

File "/home/gabriela/PyGnome/py_gnome/gnome/environment/gridded_objects_base.py", line 893, in from_netCDF
var.init_from_netCDF(*args, **kwargs)

File "/home/gabriela/PyGnome/py_gnome/gnome/environment/gridded_objects_base.py", line 798, in init_from_netCDF
ds = dg = get_dataset(grid_file)

File "/home/gabriela/anaconda3/envs/gnome/lib/python3.8/site-packages/gridded/utilities.py", line 353, in get_dataset
return nc4.MFDataset(ncfile)

File "src/netCDF4/_netCDF4.pyx", line 6805, in netCDF4._netCDF4.MFDataset.init

OSError: master dataset /media/gabriela/WDBlue_2/CIGOM/hycom_4km/HYCOM-DAILY-20210101.nc does not have a aggregation dimension

Another doubt, how I can use de .json files from ADIOS oil, I receive an error when I tried to load a file, the error is:

AttributeError: 'GnomeOil' object has no attribute 'sara_type'

Thank you for the help.
Gaby

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants