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

Use argopy for ftp download of data #1

Open
gmaze opened this issue Apr 26, 2022 · 2 comments
Open

Use argopy for ftp download of data #1

gmaze opened this issue Apr 26, 2022 · 2 comments

Comments

@gmaze
Copy link
Member

gmaze commented Apr 26, 2022

Instead of using the ftp library, one could use argopy to retrieve the multi-profile file of a float like this:

from argopy import DataFetcher as ArgoDataFetcher

wmo = 7900549
ds = ArgoDataFetcher(src='gdac', mode='expert', cache=True).float(wmo).to_xarray()
ds = ds.argo.point2profile()

In the notebook example, I think we could follow on to work with this dataset, but one could simply save it as a netcdf file as well:

ds.to_netcdf(wmo+ '_prof.nc')
@imab4bsh
Copy link
Member

The idea of getting the original netcdf file is related directly with the BSH DMQC activities:

  1. One needs to estimate the positions before running OWC, which takes the netcdf file downloaded from coriolis as input.
  2. Then the file can be modified as necessary and then is sent back to coriolis, also as a netcdf file.
    So I have a question @gmaze , is the output of
    ds.to_netcdf(wmo+ '_prof.nc')
    an exact mirror of the netcdf file from the coriolis GDAC?

@gmaze
Copy link
Member Author

gmaze commented May 16, 2022

Using the fetcher this way: NO this is not the exact GDAC netcdf file !

  • attributes (global and for variables) are modified
  • the N_PROF may be different

If you want to retrieve the raw GDAC file, you can do this (this is undocumented):

# Point to the float you want:
argo_set = ArgoDataFetcher(src='gdac', mode='expert', cache=True).float(wmo)
# Get the netcdf file location:
uri = argo_set.uri[0] # uri is a list, take the 1st item because we fetch only one float here
# Load the file:
ds = argo_set.fetcher.fs.open_dataset(uri, decode_cf=1, use_cftime=0, mask_and_scale=1)

You can then modify this dataset and save it with to_netcdf

note: using to_xarray() on the above argo_set (like in your question) will do the raw download and then perform a lot of checking, possibly modifications, before returning a modified dataset.

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

2 participants