JuliaGeo / GRIBDatasets.jl

A high level interface to GRIB encoded files.
MIT License
12 stars 5 forks source link

export dimnames #30

Open likev opened 2 months ago

likev commented 2 months ago

A GRIB file may contains many Dimensions like this:

Dataset: 20240411000000-0h-oper-fc.grib2
Group: /

Dimensions
   lon = 1440
   lat = 721
   heightAboveGround = 1
   heightAboveGround_2 = 1
   heightAboveGround_3 = 1
   isobaricInhPa = 13
   isobaricInhPa_2 = 13
   isobaricInhPa_3 = 13
   isobaricInhPa_4 = 13
   isobaricInhPa_5 = 13
   isobaricInhPa_6 = 13
   isobaricInhPa_7 = 13
   isobaricInhPa_8 = 13
   depthBelowLandLayer = 1
   depthBelowLandLayer_2 = 1
   depthBelowLandLayer_3 = 1
   depthBelowLandLayer_4 = 1
   valid_time = 1

We need to know which Dimension a Variable contains before accessing that Variable. Currently I can get this Dimension info with GRIBDatasets.CDM.dimnames(ds["d"]) which is long.

tcarion commented 3 days ago

Hi!

I'm not a big fan of exporting pretty non-specific names like dimnames. BTW, it is in scope of the GRIBDatasets module, so you can just GRIBDatasets.dimnames(ds["d"]). You can also import it once for all in your namespace with

using GRIBDatasets: dimnames
dimnames(ds["d"])