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

make it possible to import dataset with single time instance #1496

Merged
merged 4 commits into from
Jan 15, 2024

Conversation

dicaearchus
Copy link
Contributor

As shown in the tutorial it is possible to assign date information via the timestamp keyword. However, if a single instance is given, this gave errors. Hence the following adjustments resolve this issue.

Example code snippet:

depth = Field.from_netcdf([f"{elev_dir}/bodem-zunov4.nc"], 'Z',
                          {'lat': 'lat', 'lon': 'lon'},
                          interp_method=interp, time_periodic=True,
                          timestamps=[np.datetime64("2020-01-01")])
depth.name = 'Z'
fieldset.add_field(depth)

fixed import with single timestamp
added test with timestamp as well
make it PEP-8 compliant
@erikvansebille erikvansebille merged commit 9d5c2e4 into OceanParcels:master Jan 15, 2024
11 checks passed
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