-
Notifications
You must be signed in to change notification settings - Fork 138
Adds a FVCOM reader which builds on netCDF4. Reads the next timestep … #1755
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
base: master
Are you sure you want to change the base?
Conversation
…synchronously. In practice, this allows you to lower the model timestep without penalty in terms of simulation time, since you won't need to wait for the next timestep to load as you enter it. (with an appropriately low timestep, that is)
| def _configure_fields_to_read_from_fvcom(self): | ||
| """ | ||
| FVCOM stores fields with different long_names and variable names than done internally in | ||
| opendrift. Furthermore, we want to be able to advect using either 2d or 3d fields. |
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.
OpenDrift follows CF-convention, and so should FVCOM.
https://cfconventions.org/Data/cf-standard-names/current/build/cf-standard-name-table.html
variable names and long names are mostly irrelevant and ignored - as these are user/institution/model-specific and not standardised. standard_name attribute is the only thing that matters.
|
(Tests seem to be failing due to a file that you forgot to include.) Very interesting work! If it works well and robustly - it would be of interest to generalise this concept to other (any) readers. But, in line with comments to #1756: However, there should not be a need for any FVCOM-specific-readers at all - we should ideally have just a single unstructured reader adhering to the UGRID conventions - and which is also planned. However, as this clean-up is not likely to happen in the next few months, I am fine with including this reader in the meantime. But we should then add the missing file and ensure that all tests are passing. |
|
To illustrate one possible solution for a future more generic and cleaner usage:
where
a preprocessor could be a single module in a subfolder named "preprocessors", and which opens and transforms a dataset to become both CF-compliant (in all cases) and UGRID compliant (in the case of unstructured modeles). E.g. a FVCOM preprocessor would add the missing An alternative to the above, would be that the reader of any non-compliant datasets would be a thin wrapper that performs the compatibility transformation of the dataset, before calling the generic unstructured reader. Then you could still have readers named e.g. |
It's not much faster, I mostly use it to afford a lower timestep. The total simulation time is still limited by read time for the next timestep. But in the best case scenario, if reading one timestep takes 5s and you iterate while it's loading, you essentially save 5s pr block of data loaded to memory throughout the simulation compared to using the same timestep and stopping to load at each block. In practice the saving is less, since you often have to turn down the timestep in opendrift so that you don't need to stop and wait for the next block. I've noticed that I have less particles hitting the shore when using the async reader due to the lower timestep, which I suppose is the most significant change for our use cases. |
The only reason why it's not in the xarray reader is that we've worked on the readers separately. I would also like to add the vertical interpolation scheme to the xarray reader at some point. |
Ok, that is understandable. But then a common goal is that these two FVCOM readers should be merged in the future - and with the ultimate goal of a generic unstructured reader that works for all unstructured models. |
Yep, and I think we can do that within a few months - so to keep things clearer, I think don't need to merge this reader into the repository, but rather update the xarray one with the methods proposed in this reader (y) |
|
Yes, I agree it is better to not load too much "work in progess" into the main repository. Btw, for testing it would be useful to have some "standard" or "reference" FVCOM output files to test on. But I am not ware of any such, and understand the different versions of FVCOM can have slightly different output. |
Ok, sounds like we have a plan :) I talked briefly with @poplarShift about subsetting data from one of our models that can be used for testing. We just have to find time for it, we will come back to you once we have a plan! |
…synchronously. In practice, this allows you to lower the model timestep without penalty in terms of simulation time, since you won't need to wait for the next timestep to load as you enter it. (with an appropriately low timestep, that is)
Supersedes #1752