NCAS-CMS / NCAS-CMS/umfive

Incorrect size-1vertical dimension for some variables

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

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
2
Forks
1
Avg merge
12h 56m
Merged PRs (30d)
3

Description

TOTAL MOISTURE FLUX variables are created with a size-1 vertical dimension, when they shouldn't have one.

Example lookup header:

UM_m01s30i407_vn1308: 1/124 lookup headers
------------------------------------------
LBYR: 1950 LBMON: 1 LBDAT: 1 LBHR: 6 LBMIN: 0 LBDAY: 0 LBYRD: 1950 LBMOND: 1
LBDATD: 1 LBHRD: 0 LBMIND: 0 LBDAYD: 0 LBTIM: 11 LBFT: 6 LBLREC: 4915200
LBCODE: 1 LBHEM: 0 LBROW: 1920 LBNPT: 2560 LBEXT: 0 LBPACK: 0 LBREL: 3 LBFC: 0
LBCFC: 0 LBPROC: 0 LBVC: 0 LBRVC: 0 LBEXP: 0 LBEGIN: 94638592 LBNREC: 4915200
LBPROJ: 900 LBTYP: 0 LBLEV: 0 LBRSVD1: 0 LBRSVD2: 0 LBRSVD3: 0 LBRSVD4: 0
LBSRCE: 13081111 LBUSER1: 1 LBUSER2: 94638592 LBUSER3: 0 LBUSER4: 30407
LBUSER5: 0 LBUSER6: 0 LBUSER7: 1 BRSVD1: 0.0 BRSVD2: 0.0 BRSVD3: 0.0
BRSVD4: 0.0 BDATUM: 0.0 BACC: -99.0 BLEV: -1.0 BRLEV: 0.0 BHLEV: 0.0
BHRLEV: 0.0 BPLAT: 90.0 BPLON: 0.0 BGOR: 0.0 BZY: -90.046875 BDY: 0.09375
BZX: -0.0703125 BDX: 0.140625 BMDI: -1073741824.0 BMKS: 1.0

Leads to

>>> # CURRENTLY have spurious `dimension` dimensions:
>>> import umfive
>>> u = umfive.File('dz876a.pc1950jan')
>>> print(u)
dz876a.pc1950jan: <umfive.File: 2 data variables, 7 metadata variables>
    Data variables:
        UM_m01s30i407_vn1308: <umfive.DataVariable: UM_m01s30i407_vn1308, shape=(124, 1, 1920, 2560), dimensions=(time, dimension1, latitude, longitude)>
        UM_m01s30i408_vn1308: <umfive.DataVariable: UM_m01s30i408_vn1308, shape=(124, 1, 1920, 2560), dimensions=(time, dimension1, latitude, longitude)>
    Metadata variables:
        time: <umfive.DimensionScale: time, shape=(124,)>
        latitude: <umfive.DimensionScale: latitude, shape=(1920,)>
        bounds2: <umfive.DimensionScale: bounds2, size=2>
        latitude_bounds: <umfive.Variable: latitude_bounds, shape=(1920, 2), dimensions=(latitude, bounds2)>
        longitude: <umfive.DimensionScale: longitude, shape=(2560,)>
        longitude_bounds: <umfive.Variable: longitude_bounds, shape=(2560, 2), dimensions=(longitude, bounds2)>
        dimension1: <umfive.DimensionScale: dimension1, size=1>

when what we expect is no dimension1 dimension scale:

>>> # EXPECTED no vertical dimension:
>>> u = umfive.File('dz876a.pc1950jan')
>>> print(u)
dz876a.pc1950jan: <umfive.File: 2 data variables, 6 metadata variables>
    Data variables:
        UM_m01s30i407_vn1308: <umfive.DataVariable: UM_m01s30i407_vn1308, shape=(124, 1920, 2560), dimensions=(time, latitude, longitude)>
        UM_m01s30i408_vn1308: <umfive.DataVariable: UM_m01s30i408_vn1308, shape=(124, 1920, 2560), dimensions=(time, latitude, longitude)>
    Metadata variables:
        time: <umfive.DimensionScale: time, shape=(124,)>
        latitude: <umfive.DimensionScale: latitude, shape=(1920,)>
        bounds2: <umfive.DimensionScale: bounds2, size=2>
        latitude_bounds: <umfive.Variable: latitude_bounds, shape=(1920, 2), dimensions=(latitude, bounds2)>
        longitude: <umfive.DimensionScale: longitude, shape=(2560,)>
        longitude_bounds: <umfive.Variable: longitude_bounds, shape=(2560, 2), dimensions=(longitude, bounds2)>

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 at the umfive.File loading path and reproduce the issue with dz876a.pc1950jan, checking how TOTAL MOISTURE FLUX lookup headers become dimensions. Confirm that the two example variables no longer get a size-1 vertical dimension or dimension1 scale, while time, latitude, longitude, and their bounds remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.