Open jbbremnes opened 10 months ago
Thank you for reporting this issue!
This is due to the fact that coordinate variables defined on multiple dimensions (as is the case here with Lambert projection) are currently not handled properly. I will try to find a fix
Thanks for looking into this. If you like, you may add the grib file or part of it to your grib examples.
@jbbremnes, your file actually brought out multiple issues that wasn't accounted for properly by GRIBDatasets! It should be better now. First the lambert projection case is now handled.
But your file also presents a specific edge case where some of the variables are defined on multiple types of vertical levels. I don't know how to handle this, and it seems that the python cfgrib is not handling it either. So after PR #19 is merged, GRIBDatasets will give a more explanatory error:
julia> ds = GRIBDataset("MEPS_20230816_0600_h_9.grib2");
julia> ds["t"]
ERROR: The variable `t` is defined on multiple types of vertical levels. This is not supported by GRIBDatasets.
To overcome this issue, you can try to filter the GRIB file on some specific level. In your case, try to re-open the dataset with one of:
GRIBDataset("MEPS_20230816_0600_h_9.grib2", filter_by_values=Dict("typeOfLevel" => "heightAboveGround"))
GRIBDataset("MEPS_20230816_0600_h_9.grib2", filter_by_values=Dict("typeOfLevel" => "isobaricInhPa"))
GRIBDataset("MEPS_20230816_0600_h_9.grib2", filter_by_values=Dict("typeOfLevel" => "tropopause"))
As the error suggests, a workaround is to filter your grib file on some specific vertical level. This should work after you do that.
Would you have some smaller file with the same structure ? Like with a croped area ? If not I'll try do modify it myself and add it to the test samples.
Thank you, @tcarion ! We do not have smaller files of similar content, so please feel free to reduce the current one. In December I will look into reading many grib files in parallel.
Trying the example below with a grib file (186 MB) of forecasts from the Norwegian Meteorological Institute results in the following
Looping through the file using GRIB.jl only works fine. This is in Julia 1.9.0 with the following packages installed