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 dimnames #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

export dimnames #30

wants to merge 1 commit into from

Conversation

likev
Copy link

@likev likev commented Apr 11, 2024

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.

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
Copy link
Member

tcarion commented Jul 3, 2024

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"])

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