Commit 82d66f71 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added standard_name on netCDF zaxes

parent 30b65565
2011-04-28 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Added standard_name on netCDF zaxes
2011-04-27 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Added support for FILETYPE_NC4C (netcdf4 classic)
......
CDI NEWS
--------
Version 1.5.1 (?? ??? 2011):
New features:
* Added support for FILETYPE_NC4C (netcdf4 classic)
Version 1.5.0 (15 March 2011):
New features:
......
......@@ -724,6 +724,9 @@ void zaxisInqName(int zaxisID, char *name);
/* zaxisInqLongname: Get the longname of a Z-axis */
void zaxisInqLongname(int zaxisID, char *longname);
/* zaxisInqStdname: Get the standard name of a Z-axis */
void zaxisInqStdname(int zaxisID, char *stdname);
/* zaxisInqUnits: Get the units of a Z-axis */
void zaxisInqUnits(int zaxisID, char *units);
......
......@@ -2106,6 +2106,7 @@ void cdfDefZaxis(int streamID, int zaxisID)
{
/* char zaxisname0[256]; */
char axisname[256];
char stdname[256];
char longname[256];
char units[256];
char tmpname[256];
......@@ -2276,12 +2277,15 @@ void cdfDefZaxis(int streamID, int zaxisID)
zaxisInqLongname(zaxisID, longname);
zaxisInqUnits(zaxisID, units);
zaxisInqStdname(zaxisID, stdname);
cdf_def_var(fileID, axisname, (nc_type) xtype, 1, &dimID, &ncvarid);
if ( (len = strlen(longname)) )
cdf_put_att_text(fileID, ncvarid, "long_name", len, longname);
if ( (len = strlen(units)) )
cdf_put_att_text(fileID, ncvarid, "units", len, units);
if ( (len = strlen(stdname)) )
cdf_put_att_text(fileID, ncvarid, "standard_name", len, stdname);
cdf_put_att_text(fileID, ncvarid, "axis", 1, "Z");
......
......@@ -12,36 +12,41 @@
#include "stream_int.h"
#define LevelDown 0
#define LevelUp 1
static struct {
unsigned char positive;
char *name;
char *longname;
char *units;
char *stdname;
char *units; // 1: up; 2: down
}
ZaxistypeEntry[] = {
{"sfc", "surface", ""},
{"lev", "generic", "level"},
{"lev", "hybrid", "level"},
{"lev", "hybrid_half", "level"},
{"lev", "pressure", "Pa"},
{"height", "height", "m"},
{"depth", "depth_below_sea", "m"},
{"depth", "depth_below_land", "cm"},
{"lev", "isentropic", "K"},
{"lev", "trajectory", ""},
{"alt", "altitude", "m"},
{"lev", "sigma", "level"},
{"lev", "meansea", "level"},
{0, "sfc", "surface", "", ""},
{0, "lev", "generic", "", "level"},
{2, "lev", "hybrid", "", "level"},
{2, "lev", "hybrid_half", "", "level"},
{2, "lev", "pressure", "air_pressure", "Pa"},
{1, "height", "height", "", "m"},
{2, "depth", "depth_below_sea", "", "m"},
{2, "depth", "depth_below_land", "", "cm"},
{0, "lev", "isentropic", "", "K"},
{0, "lev", "trajectory", "", ""},
{1, "alt", "altitude", "", "m"},
{0, "lev", "sigma", "", "level"},
{0, "lev", "meansea", "", "level"},
};
static int CDI_MaxZaxistype = sizeof(ZaxistypeEntry) / sizeof(ZaxistypeEntry[0]);
#define LevelDown 0
#define LevelUp 1
typedef struct {
unsigned char positive;
char name[256];
char longname[256];
char stdname[256];
char units[256];
double *vals;
double *lbounds;
......@@ -361,6 +366,9 @@ int zaxisCreate(int zaxistype, int size)
zaxisDefLongname(zaxisID, ZaxistypeEntry[zaxistype].longname);
zaxisDefUnits(zaxisID, ZaxistypeEntry[zaxistype].units);
if ( *ZaxistypeEntry[zaxistype].stdname )
strcpy(zaxisptr->stdname, ZaxistypeEntry[zaxistype].stdname);
vals = (double *) malloc(size*sizeof(double));
for ( ilev = 0; ilev < size; ilev++ )
......@@ -576,6 +584,18 @@ void zaxisInqUnits(int zaxisID, char *units)
}
void zaxisInqStdname(int zaxisID, char *stdname)
{
zaxis_t *zaxisptr;
zaxisptr = zaxis_to_pointer(zaxisID);
zaxis_check_ptr(zaxisID, zaxisptr);
strcpy(stdname, zaxisptr->stdname);
}
void zaxisDefPrec(int zaxisID, int prec)
{
zaxis_t *zaxisptr;
......
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