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

Update conversion from GRIB to NetCDF example #24

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

Alexander-Barth
Copy link
Member

@Alexander-Barth Alexander-Barth commented Feb 19, 2024

The call NCDatasets.write(netcdf_file,GRIBDataset(grib_file)) does not dispatch on any type defined in NCDatasets and the function write is a generic function from julia Base. Currently, NCDatasets is the only module which defines a function write(dest_filename::AbstractString, src::CommonDataModel.AbstractDataset). I am wondering if it is not better to change this example with the netcdf dataset as the first argument to write.

For your information, I am working on ZarrDatasets.jl (still unregistered) and the GRIB to Zarr conversion also works in a very similar way:

using GRIBDatasets
using Downloads: download
using ZarrDatasets

grib_file = download("https://github.com/JuliaGeo/GRIBDatasets.jl/raw/98356af026ea39a5ec0b5e64e4289105492321f8/test/sample-data/era5-levels-members.grib")

zarr_dir = tempname()
mkdir(zarr_dir)
ZarrDataset(zarr_dir,"c") do ds
    write(ds,GRIBDataset(grib_file))
end

@Alexander-Barth Alexander-Barth changed the title Update convertion from GRIB to NetCDF example Update conversion from GRIB to NetCDF example Feb 19, 2024
@tcarion
Copy link
Member

tcarion commented Feb 23, 2024

I agree that write is better defined this way :-) Thank you very much for the PR !

@tcarion tcarion merged commit 85f797e into JuliaGeo:main Feb 23, 2024
6 checks passed
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

Successfully merging this pull request may close these issues.

2 participants