7- A standard_name attribute where the standard name value indicates longitude, latitude, height/depth, time.
8- If the direction is still undetermined, or if the dimension does not correspond to a coordinate variable then a few obvious dimension names can indicate the direction:9- If the axis direction is still undermined, then they will be assigned, starting with the largest grid, working right to left with the first axis an x axis, then a y axis, and so on. So the file here would look at bounds_lat(jmax, imax, nv) and put nv in the x direction, imax in the y direction, and jmax in the z direction. Then it cannot reconcile that with the 2-D grid (jmax, imax).
Ansley
Hi all,
I have investigated a little bit more on the internal ferret mechanism that leads to produce this error.
**ERROR: inconsistent data grids: File needs axis attributes on coordinate variables indicating correct directions
Starting from an example given by the CF convention description from the folowing paragraphhttps://cfconventions.org/Data/cf-conventions/cf-conventions-1.9/cf-conventions.html#cell-boundaries
I have reproduced the error from a very simple exemple.
$ cat notok.cdlnetcdf notok {
dimensions:
jmax = 1 ;
imax = 1 ;
nv = 4 ;
variables:
double lat(jmax, imax) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:bounds = "bounds_lat" ;
double lon(jmax, imax) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:bounds = "bounds_lon" ;
double bounds_lat(jmax, imax, nv) ;
double bounds_lon(jmax, imax, nv) ;
double sample(jmax, imax) ;
sample:coordinates = "lon lat" ;
data:
lat = -28;
lon = 157;
bounds_lat = -29, -29, -27, -27;
bounds_lon = 156, 158, 158, 156;
sample = 1 ;
}
$ ncgen -o notok.nc notok.cdl$ ferretyes? use notok.nc*** NOTE:
*** NOTE: Could not adjust grid for variable lat
**ERROR: inconsistent data grids: File needs axis attributes on coordinate variables indicating correct directions
The same file with modified dimension names (jmax, imax replaced by y, x) can be openned.
$ cat ok.cdlnetcdf ok {
dimensions:
y = 1 ;
x = 1 ;
nv = 4 ;
variables:
double lat(y, x) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:bounds = "bounds_lat" ;
double lon(y, x) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:bounds = "bounds_lon" ;
double bounds_lat(y, x, nv) ;
double bounds_lon(y, x, nv) ;
double sample(y, x) ;
sample:coordinates = "lon lat" ;
data:
lat = -28;
lon = 157;
bounds_lat = -29, -29, -27, -27;
bounds_lon = 156, 158, 158, 156;
sample = 1 ;
}
$ ncgen -o ok.nc ok.cdl$ ferretyes? use ok.nc
I would like to understand why ?
Best regardsPatrick
--
Data Analytics and Visualization Engineer / Project Manager
LSCE/IPSL, CEA-CNRS-UVSQ laboratory
LSCE - Climate and Environment Sciences Laboratory
IPSL - Institut Pierre Simon Laplace
--
De: "Patrick Brockmann" <patrick.brockmann@xxxxxxxxxxxx>
À: "ferret users" <ferret_users@xxxxxxxx>
Cc: "Thanh-Lam Nguyen" <sebastien.nguyen@xxxxxxxxxxxx>
Envoyé: Lundi 27 Septembre 2021 16:48:27
Objet: [ferret_users] inconsistent data grids: File needs axis attributes on coordinate variables indicating correct direction
Hi ferreters,
A colleague has encountered a strange problem as he was trying to
nicely respect the netCDF CF conventions to describe a curvilinear grid (NEMO configuration).
ferret complains about some inconsistent data grid and missing axis attributes.
use notok.nc *** NOTE: *** NOTE: Could not adjust grid for variable mask_T **ERROR: inconsistent data grids: File needs axis attributes on coordinate variables indicating correct directions
Stranger, if I change the name of the dimension, then the file
is read. I have not been able to fix this by adding a direction attribute as requested.
The file is simple as:
$ ncdump notok.nc netcdf notok { dimensions: y_grid_T = 1 ; x_grid_T = 1 ; nvertex_grid_T = 4 ; variables: double bounds_lat_grid_T(y_grid_T, x_grid_T, nvertex_grid_T) ; double bounds_lon_grid_T(y_grid_T, x_grid_T, nvertex_grid_T) ; byte mask_T(y_grid_T, x_grid_T) ; mask_T:cell_measures = "area: area_grid_T" ; mask_T:coordinates = "nav_lat_grid_T nav_lon_grid_T" ; double nav_lat_grid_T(y_grid_T, x_grid_T) ; nav_lat_grid_T:standard_name = "latitude" ; nav_lat_grid_T:long_name = "Latitude" ; nav_lat_grid_T:units = "degrees_north" ; nav_lat_grid_T:bounds = "bounds_lat_grid_T" ; double nav_lon_grid_T(y_grid_T, x_grid_T) ; nav_lon_grid_T:standard_name = "longitude" ; nav_lon_grid_T:long_name = "Longitude" ; nav_lon_grid_T:units = "degrees_east" ; nav_lon_grid_T:bounds = "bounds_lon_grid_T" ; data: bounds_lat_grid_T = -29.5895932339965, -29.5895932339965, -27.835621888657, -27.835621888657 ; bounds_lon_grid_T = 156.999148343641, 158.999201071309, 158.999201071309, 156.999148343641 ; mask_T = 1 ; nav_lat_grid_T = -28.7162844516478 ; nav_lon_grid_T = 157.999608915878 ; } If I remove _grid_T suffix then the file is read correctly. $ ncgen -o notok.nc notok.cdl $ sed -e 's/_grid_T//g' notok.cdl > ok.cdl $ ncgen -o ok.nc ok.cdl Any idea on why there is the unexpected behaviour (test on names of dimensions) ?
Patrick
--
Data Analytics and Visualization Engineer / Project Manager
LSCE/IPSL, CEA-CNRS-UVSQ laboratory
LSCE - Climate and Environment Sciences Laboratory
IPSL - Institut Pierre Simon Laplace
--sed -e 's/_grid_T//g' tyty.cdl > tyty1.cdl