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

Allowing for different netcdf engine in Field.from_netcdf #460

Merged
merged 6 commits into from
Oct 3, 2018

Conversation

erikvansebille
Copy link
Member

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

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
Copy link
Contributor

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
Copy link
Contributor

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)

@delandmeterp delandmeterp merged commit f97623b into master Oct 3, 2018
@delandmeterp delandmeterp deleted the fix-mitgcm-time-dimension branch October 3, 2018 14:26
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

Successfully merging this pull request may close these issues.

2 participants