fsspec / fsspec/kerchunk

Create coordinate from dimension?

Open
#346 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
366
Forks
96
Avg merge
24m
Merged PRs (30d)
1

Description

Hi! I've been trying to convert an existing dimension in my ROMS model output file (e.g. eta_rho) into a coordinate when generating the MultiZarr output. This would allow me to add an attribute to the dimension/coordinate such that it would be properly identified by cf_xarray. I've been messing around with preprocesing and postprocessing to do this and haven't figured it out (yet) but I also keep feeling like it's probably possible using coo_map. I've tried with the coo_map approach a few ways and haven't had any luck that way either. It looks something like

mzz = MultiZarrToZarr(
    json_list,
    concat_dims=["ocean_time"],
    identical_dims= ['lat_rho', 'lon_rho', "lon_psi", "lat_psi",
                    "lat_u", "lon_u", "lat_v", "lon_v", 
                    "Akk_bak","Akp_bak","Akt_bak","Akv_bak","Cs_r","Cs_w",
                    "FSobc_in","FSobc_out","Falpha","Fbeta","Fgamma","Lm2CLM",
                    "Lm3CLM", "LnudgeM2CLM", "LnudgeM3CLM", "LnudgeTCLM",
                    "LsshCLM", "LtracerCLM", "LtracerSrc", "LuvSrc",
                    "LwSrc", "M2nudg", "M2obc_in", "M2obc_out", "M3nudg",
                    "M3obc_in", "M3obc_out", "Tcline", "Tnudg","Tobc_in", "Tobc_out",
                    "Vstretching", "Vtransform", "Znudg", "Zob", "Zos", "angle",
                    "dstart", "dt", "dtfast", "el", "f", "gamma2", "grid", "h",
                    "hc", "mask_psi", "mask_rho", "mask_u", "mask_v", "nHIS", "nRST",
                    "nSTA", "ndefHIS",  "ndtfast", "ntimes", "pm", "pn", "rdrg", 
                    "rdrg2", "rho0", "spherical", "theta_b", "theta_s", "xl",
                    ],
    coo_map = {"ocean_time": "cf:ocean_time",
            #    "eta_rho": list(np.arange(1044))  # tried this
            #    'eta_rho': "data:eta_rho",  # tried this too
               },
    # preprocess=preprocess,
    # postprocess=postprocess,
)

is there an easy way to do this or should I pursue my pre/post processing approach? Thanks.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with MultiZarrToZarr and its coo_map handling, using the ROMS eta_rho example in the issue as the case to investigate. Compare the attempted coo_map forms with the preprocessing and postprocessing alternatives; done means determining whether an existing dimension can become a coordinate with the needed cf_xarray attribute, and documenting or implementing the supported path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.