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

Export Netcdf file #434

Open
gmaze opened this issue Jan 27, 2025 · 2 comments
Open

Export Netcdf file #434

gmaze opened this issue Jan 27, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@gmaze
Copy link
Member

gmaze commented Jan 27, 2025

As of now, Argopy has focused on accessing/reading/loading Argo data as xarray datasets.

But for operators who modify the content of a dataset, by adding calibration information for instance, there is a need to be able export these updated/augmented xarray datasets to netcdf files, following the Argo conventions for variables encoding.

This should requires a static dictionary asset with all possible Argo variables and the corresponding encoding information.

One tricky part is for string variables.
For instance:DATA_TYPE is encoded as an array of dtype('S1') with length 16, along a STRING16 dimensions, in netcdf files
Hence, when decoded abruptly with xarray, it is returned as 16 values with dtype=|S1], along a STRING16 dimensions of length 16.
But after variable casting by argopy, this variable is more appropriately returned as 1 value with dtype=<U16

A possible API could be:

# Load raw data (but appropriately casted by argopy):
ds = ArgoFloat(WMO).open_dataset('prof')

# [...] Do some stuff on ds 

# Export dataset as a clean Argo netcdf file:
ds.argo.to_netcdf('updated.nc', convention='Argo-3.1 CF-1.6')

The goal would be for the new netcdf to pass the Argo file checker and be valid for submission to a DAC

@gmaze gmaze added the enhancement New feature or request label Jan 27, 2025
@gmaze
Copy link
Member Author

gmaze commented Jan 27, 2025

poke @CKermabon @quai20 @tcarval

@gmaze
Copy link
Member Author

gmaze commented Jan 28, 2025

there is a lot of features in the bgcArgoDMQC library in here:
https://github.com/ArgoCanada/bgcArgoDMQC/blob/main/bgcArgoDMQC/io/netcdf.py

but it is all based on low-level netcdf4 dataset manipulation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant