pyoceans / pocean-core

🐍 + 🌊 A python framework for working with met-ocean data
https://pyoceans.github.io/pocean-core/
MIT License
22 stars 16 forks source link

pytest fixes #86

Open jcermauwedu opened 3 months ago

jcermauwedu commented 3 months ago

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

ocefpaf commented 2 months ago

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

Sorry but I have no idea. Those were added long before I got here 😬