Commit 05b9e160 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Preserve NetCDF attribute positive on data variables.

parent 3667ee84
2020-02-12 Uwe Schulzweida
* Preserve NetCDF attribute positive on data variables
2020-01-10 Uwe Schulzweida 2020-01-10 Uwe Schulzweida
* NetCDF: addes support for non global Gaussian grids * NetCDF: addes support for non global Gaussian grids
......
...@@ -1143,6 +1143,9 @@ void cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int ...@@ -1143,6 +1143,9 @@ void cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int
} }
} }
if ( ncvars[ncvarid].natts == 0 )
ncvars[ncvarid].atts = (int*) Malloc((size_t)nvatts*sizeof(int));
for ( iatt = 0; iatt < nvatts; iatt++ ) for ( iatt = 0; iatt < nvatts; iatt++ )
{ {
int nc_cell_id = CDI_UNDEFID; int nc_cell_id = CDI_UNDEFID;
...@@ -1422,11 +1425,15 @@ void cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int ...@@ -1422,11 +1425,15 @@ void cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int
cdf_set_dim(ncvars, ncvarid, 0, Z_AXIS); cdf_set_dim(ncvars, ncvarid, 0, Z_AXIS);
ncdims[ncvars[ncvarid].dimids[0]].dimtype = Z_AXIS; ncdims[ncvars[ncvarid].dimids[0]].dimtype = Z_AXIS;
} }
if ( ncvars[ncvarid].ndims == 0 ) else if ( ncvars[ncvarid].ndims == 0 )
{ {
cdf_set_var(ncvars, ncvarid, FALSE); cdf_set_var(ncvars, ncvarid, FALSE);
ncvars[ncvarid].islev = true; ncvars[ncvarid].islev = true;
} }
else
{
ncvars[ncvarid].atts[ncvars[ncvarid].natts++] = iatt;
}
} }
else if ( isNumber && strIsEqual(attname, "_FillValue") ) else if ( isNumber && strIsEqual(attname, "_FillValue") )
{ {
...@@ -1525,9 +1532,6 @@ void cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int ...@@ -1525,9 +1532,6 @@ void cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int
} }
else else
{ {
if ( ncvars[ncvarid].natts == 0 )
ncvars[ncvarid].atts = (int*) Malloc((size_t)nvatts*sizeof(int));
ncvars[ncvarid].atts[ncvars[ncvarid].natts++] = iatt; ncvars[ncvarid].atts[ncvars[ncvarid].natts++] = iatt;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment