JuliaDataCubes / YAXArrays.jl

Yet Another XArray-like Julia package
https://juliadatacubes.github.io/YAXArrays.jl/
Other
103 stars 18 forks source link

Skipping keys with open_dataset ? #465

Open Balinus opened 4 hours ago

Balinus commented 4 hours ago

Is there a way to skip a variable/keys/etc when using open_dataset?

Right now, I have badly formatted netcdf file, where there is no information on one of the coordinates (nbnds):

image

I am not able to open the file with open_dataset though and I was wondering if it was possible to ignore some the of variables or something similar:

image

Balinus commented 3 hours ago

output from NCDatasets.jl:

Group: /

Dimensions
   forecast_date = 1
   lead = 4
   lat = 258
   lon = 480
   quantiles = 19
   nbnds = 2

Variables
  forecast_date   (1)
    Datatype:    DateTime (Int64)
    Dimensions:  forecast_date
    Attributes:
     long_name            = Forecast Creation Date
     units                = days since 2024-03-15
     calendar             = proleptic_gregorian

  lead   (4)
    Datatype:    Int64 (Int64)
    Dimensions:  lead
    Attributes:
     long_name            = Forecast Lead
     units                = months
     bounds               = lead_bnds

  lat   (258)
    Datatype:    Union{Missing, Float32} (Float32)
    Dimensions:  lat
    Attributes:
     _FillValue           = NaN
     long_name            = Latitude

  lon   (480)
    Datatype:    Union{Missing, Float32} (Float32)
    Dimensions:  lon
    Attributes:
     _FillValue           = NaN
     long_name            = Longitude

  quantiles   (19)
    Datatype:    Union{Missing, Float64} (Float64)
    Dimensions:  quantiles
    Attributes:
     _FillValue           = NaN
     long_name            = Quantiles

  vals   (19 × 480 × 258 × 4 × 1)
    Datatype:    Union{Missing, Float32} (Float32)
    Dimensions:  quantiles × lon × lat × lead × forecast_date
    Attributes:
     _FillValue           = NaN
     long_name            = Average Temperature
     units                = degC

  anom   (19 × 480 × 258 × 4 × 1)
    Datatype:    Union{Missing, Float32} (Float32)
    Dimensions:  quantiles × lon × lat × lead × forecast_date
    Attributes:
     _FillValue           = NaN
     long_name            = Average Temperature Anomaly
     units                = degC

  forecast_period   (2 × 4 × 1)
    Datatype:    DateTime (Int64)
    Dimensions:  nbnds × lead × forecast_date
    Attributes:
     long_name            = Forecast Validity Period
     units                = days since 2024-04-01 00:00:00
     calendar             = proleptic_gregorian

  lead_bnds   (2 × 4)
    Datatype:    Int64 (Int64)
    Dimensions:  nbnds × lead
    Attributes:
     long_name            = Lead Bounds

Global attributes
  long_name            = Average Temperature
  units                = degC
  clim_period          = ["1990-01-01", "2019-12-31"]
  coordinates          = forecast_period