FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0130 — NetCDF variables are read in the order (time, zc, yc, xc) without checking it
ID 0130
Class KNOWN-LIMITATION
Severity 1
Status blocked

Models: —

Found: 2026-10-24, review doc/reviews/fhsim_environment-2026-10-24/README.md (plan P3, ENV-R5 d), confirmed at d0d8548

Decision needed: a sample of real SINMOD files, to learn which dimension orders occur. The plan leaves this to a follow-up until then.

Evidence

src/environment/util/NetCDFParser.cpp, read_variable_info_from_file, checks that each required dimension is present, not their order. read_dynamic_variable_data reads the data as if the order were (time, zc, yc, xc), and depthMatrix as (yc, xc).

Effect

A file with another dimension order is read transposed: the right sizes, the wrong numbers, no error.

Possible fix

Compare the order of variable.ncvar.getDim(i) with the expected one and report the variable and the two orders; or read through the dimension names so any order works.

Test that would prove it

A small file whose u-velocity has the dimensions (time, zc, xc, yc) (the helper WriteGrid in tests/NetCdfSeafloorBathymetry_Test.cpp can take the order) must be refused with the variable named, or read correctly.

Risk

A check that is stricter than the real files would refuse files that work today. Needs real SINMOD files first.