-
Notifications
You must be signed in to change notification settings - Fork 143
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
Allowing for different netcdf engine in Field.from_netcdf #460
Conversation
parcels/field.py
Outdated
@@ -50,6 +50,8 @@ class Field(object): | |||
(i.e. beyond the last available time snapshot) | |||
:param time_periodic: boolean whether to loop periodically over the time component of the Field | |||
This flag overrides the allow_time_interpolation and sets it to False | |||
:param netcdf_engine: engine to use for netcdf reading in xarray. Default is 'netcdf', | |||
but in cases where this doesn't work, setting netcdf_engine='scipy' could help |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this doc here in Field
constructor? Shouldn't it be in Field.from_netcdf()
and same for FieldSet.from_netcdf()
?
parcels/field.py
Outdated
@@ -198,6 +202,7 @@ def from_netcdf(cls, filenames, variable, dimensions, indices=None, grid=None, | |||
grid = CurvilinearSGrid(lon, lat, depth, time, time_origin=time_origin, mesh=mesh) | |||
grid.timeslices = timeslices | |||
kwargs['dataFiles'] = dataFiles | |||
kwargs['netcdf_engine'] = netcdf_engine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this in if grid is None
and not later with other kwargs (at the end of the function)
Some files (e.g. the MITgcm files of Issue #453) lead to errors when openend by Field.from_netcdf() because the default netcdf4 engine of
xarray
can't read them.For these files, this PR now provides the option to specify
netcdf_engine='scipy'
in the Field.from_netcdf and FieldSet.from_netcdf constructors