jbusecke / esgf-virtual-zarr-data-access

ESGF working group to enable data access via virtual zarrs.
Apache License 2.0
6 stars 1 forks source link

Time encoding is lost #8

Open jbusecke opened 4 months ago

jbusecke commented 4 months ago

When running virtual-zarr-script.py the xr dataset read from the json reference does not retain the time encoding.

Dataset before mean: <xarray.Dataset> Size: 73MB
Dimensions:    (time: 240, lat: 192, bnds: 2, lon: 384)
Coordinates:
    height     (time) float64 2kB dask.array<chunksize=(60,), meta=np.ndarray>
  * lat        (lat) float64 2kB -89.28 -88.36 -87.42 ... 87.42 88.36 89.28
  * lon        (lon) float64 3kB 0.0 0.9375 1.875 2.812 ... 357.2 358.1 359.1
  * time       (time) float64 2kB 6.028e+04 6.031e+04 ... 6.752e+04 6.755e+04
Dimensions without coordinates: bnds
Data variables:
    lat_bnds   (time, lat, bnds) float64 737kB dask.array<chunksize=(1, 192, 2), meta=np.ndarray>
    lon_bnds   (time, lon, bnds) float64 1MB dask.array<chunksize=(1, 384, 2), meta=np.ndarray>
    tas        (time, lat, lon) float32 71MB dask.array<chunksize=(1, 192, 384), meta=np.ndarray>
    time_bnds  (time, bnds) float64 4kB dask.array<chunksize=(1, 2), meta=np.ndarray>
Attributes: (12/44)
    Conventions:            CF-1.7 CMIP-6.2
    activity_id:            ScenarioMIP
    branch_method:          standard
    branch_time_in_child:   60265.0
    branch_time_in_parent:  60265.0
    cmor_version:           3.4.0
    ...                     ...
    sub_experiment_id:      none
    table_id:               Amon
    table_info:             Creation Date:(09 May 2019) MD5:e6ef8ececc8f33864...
    title:                  MPI-ESM1-2-HR output prepared for CMIP6
    variable_id:            tas
    variant_label:          r1i1p1f1

I think for this to work we need to wait for a solution to https://github.com/TomNicholas/VirtualiZarr/issues/117 (see https://github.com/TomNicholas/VirtualiZarr/pull/122).