Fieldset.from_netcdf with manual timestamps#540
Merged
erikvansebille merged 10 commits intoParcels-code:masterfrom Feb 25, 2019
Merged
Fieldset.from_netcdf with manual timestamps#540erikvansebille merged 10 commits intoParcels-code:masterfrom
erikvansebille merged 10 commits intoParcels-code:masterfrom
Conversation
…corresponding to velocity field data.
…TimeDim # Conflicts: # parcels/field.py
Member
|
Thanks for this Pull, @christensen5; a nice feature for some users who have netcdf files without time dimension I just tried to create a unit test that tests this new feature, but as you see it currently breaks. Can you have a look at it (see d5e7504)? Perhaps you can find why it breaks? |
added 3 commits
February 22, 2019 14:22
Author
|
Unittest should now pass. The issue was that when working with the user-provided array of timestamps, netcdfFileBuffer.time() was returning the entire array, rather than the current time for a given file. |
erikvansebille
approved these changes
Feb 22, 2019
Member
erikvansebille
left a comment
There was a problem hiding this comment.
Nice code; nothing to further comment. Well done for implementing this feature, @christensen5!
delandmeterp
approved these changes
Feb 25, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR creates an option to provide time data as a separate 1D numpy array (called 'timestamps') when creating a fieldset from a netcdf file - this is useful when time is not explicitly included within the 'dimensions' dictionary of the numpy array, but only in the 'variables' dictionary. Note the following comments on the current implementation:
All the
variables(u, v, w, temp, etc...) must be contained in the same files, and each file must correspond to exactly one timestep. I check if the number of files is equal to the length oftimestampsand throw an exception if not.Filenames must be provided as a list or as a dict; I throw an error if its a dict of dicts.
Works with deferred loading.