Skip to content

preparing a CMOR demo with a coordinate having character string entries #837

@gleckler1

Description

@gleckler1

@mauzey1 @durack1 @taylor13
With the goal of setting up a cmor demo for obs4MIPs, I am trying to reproduce a CMIP6 variable that has dimensions [latitude basin time], with "basin" being an array of character strings. A copy of the input file (hfbasin_Omon_UKESM1-0-LL_ssp370_r5i1p1f2_gnz_201501-204912.nc) used in this demo is in the same GH directory as the test.py script. It appears to have been prepared with CMOR as a contribution to CMIP6.

The difficulty I am having is almost certainly with data type of sector
cmorBasin = cmor.axis("basin", coord_vals=sector[:],units="")

but there is no error until the cmor.write (below) and no other info is provided.

Any hints???

(xarray-cmor-v20250616) u7510@perlmutter:login14:~/git/obs4MIPs-cmor-tables/demo/demo-site_colletion> python -i test.py
Traceback (most recent call last):
File "/global/u1/u/u7510/git/obs4MIPs-cmor-tables/demo/demo-site_colletion/test.py", line 42, in
cmor.write(varid,d,len(time))
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/global/homes/u/u7510/.conda/envs/xarray-cmor-v20250616/lib/python3.13/site-packages/cmor/pywrapper.py", line 799, in write
raise Exception("Error could not convert data to a numpy array")
Exception: Error could not convert data to a numpy array

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions