pocean-core icon indicating copy to clipboard operation
pocean-core copied to clipboard

pytest fixes

Open jcermauwedu opened this issue 10 months ago • 1 comments

Working on cleaning up test suite. Example datasets need to be cleaned up a little bit.

The source seems to be mismatch of data types between the variable and the missing_value attribute. Doing some tracing finds:

pytest -Werror -vv --pdb

(Pdb) tvar[:]
*** UserWarning: WARNING: missing_value not used since it
cannot be safely cast to variable data type
(Pdb) p axv.t
<class 'netCDF4._netCDF4.Variable'>
int32 time(profile)
    long_name: Profile Time
    standard_name: time
    calendar: standard
    units: seconds since 1970-01-01T00:00:00Z
    axis: T
    ioos_category: Time
    time_origin: 01-JAN-1970 00:00:00
    _CoordinateAxisType: Time
    missing_value: -9999.9
unlimited dimensions: 
current shape = (35,)
filling on, default _FillValue of -2147483647 used

One of a few source files: src/pocean-core/pocean/tests/dsg/profile/resources/om-1dy11.nc

@ocefpaf Were the sample data file hand created or script generated?

Having the missing_value data type match the variable data type is a check performed by the IOOS Compliance Checker. We will consider looking into this package when reviewing examples for the IOOS Compliance Checker during the code sprint and maybe also look into CF and other issues as well. https://github.com/ioos/ioos-code-sprint/issues/40

jcermauwedu avatar Apr 13 '24 14:04 jcermauwedu