Ouranosinc / raven

WPS services related to hydrological modeling
https://pavics-raven.readthedocs.io
MIT License
37 stars 12 forks source link

CF-Compliance of hydrographs.nc output #64

Closed huard closed 5 years ago

huard commented 5 years ago

Description

The netCDF output created by Raven has a dimension called nbasins but no matching coordinates. From the netCDF docs:

A coordinate variable is a one-dimensional variable with the same name as a dimension, which names the coordinate values of the dimension. It must not have any missing data (for example, no _FillValue or missing_value attributes) and must be strictly monotonic (values increasing or decreasing). A two-dimensional variable of type char is a string-valued coordinate variable if it has the same name as its first dimension, e.g.: char time( time, time_len); all of its strings must be unique. A variable's coordinate system is the set of coordinate variables used by the variable. Coordinates that refer to physical space are called spatial coordinates, ones that refer to physical time are called time coordinates, ones that refer to either physical space or time are called spatio-temporal coordinates.

So for example there could be a variable called nbasins storing the Raven basin index. It would probably make sense to rename nbasins to just basin or basin_id, but I guess that would break backward compatibility for users and it's not a big deal.

Here are other CF-compliance issues that were raised by CF-checker:

CHECKING NetCDF FILE: /group_workspaces/jasmin4/ceda_wps/production/cache/uploads/Hydrographs.nc
=====================
Using CF Checker Version 3.0.5
Checking against CF Version CF-1.6
Using Standard Name Table Version 61 (2018-11-13T11:55:45Z)
Using Area Type Table Version 9 (04 July 2018)

WARN: (2.6.1): No 'Conventions' attribute present

------------------
Checking variable: time
------------------
WARN: (3): No standard_name or long_name attribute specified

------------------
Checking variable: precip
------------------

------------------
Checking variable: basin_name
------------------
INFO: attribute cf_role is being used in a non-standard way
WARN: (2.2): Could not get typecode of variable.  Variable types supported are: char, byte, short, int, float, real, double
ERROR: (9.5): Invalid value for cf_role attribute

------------------
Checking variable: q_sim
------------------

------------------
Checking variable: q_obs
------------------

------------------
Checking variable: q_in
------------------

ERRORS detected: 1
WARNINGS given: 3
INFORMATION messages: 1
julemai commented 5 years ago

@huard All incorporated now. Is backward compatible. Was only some missing attributes. CF compliance checker now gives:

CHECKING NetCDF FILE: /tmp/5847.nc
=====================
Using CF Checker Version 2.0.9
Checking against CF Version CF-1.6
Using Standard Name Table Version 61 (2018-11-13T11:55:45Z)
Using Area Type Table Version 9 (04 July 2018)

------------------
Checking variable: q_sim
------------------

------------------
Checking variable: q_in
------------------

------------------
Checking variable: precip
------------------

------------------
Checking variable: time
------------------

------------------
Checking variable: basin_name
------------------

------------------
Checking variable: q_obs
------------------

ERRORS detected: 0
WARNINGS given: 0
INFORMATION messages: 0

New Raven version (rev 161) can be downloaded from my webpage URL

And is uploaded to Wiki

huard commented 5 years ago

Wow, that was fast ! Thanks, I've updated the makefile in the PR we're working on for objective functions.