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

tips and tricks: export in a way compatible with thredds servers #99

Open
jerabaul29 opened this issue Aug 26, 2024 · 2 comments
Open

Comments

@jerabaul29
Copy link
Collaborator

Looks like thredds servers do not accept int64 variables :( . I got an error message, and this seems similar to: https://stackoverflow.com/questions/48895227/output-int32-time-dimension-in-netcdf-using-xarray .

To generate files that are compatible with thredds server, and be able to upload files to e.g. adc.met.no that is hosted on thredds, one needs to make the time variables 32 bit ints (which is ok if "seconds since" and the deployment time is not many 10s of years).

This can be done by exporting as the following for now (may need to expand to more time variables if there are more included in the future):

ds.to_netcdf("./SOME_FILENAME.nc", encoding={'time': {'dtype': 'i4'}, 'time_waves_imu': {'dtype': 'i4'}})
@gauteh
Copy link
Member

gauteh commented Aug 26, 2024

You can also set this on the variables before saving. Setting a common reference is also necessary if you want to aggregate data.

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

No branches or pull requests

3 participants
@gauteh @jerabaul29 and others