Commit 003a786f authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

taxis.c: cleanup

parent c035ac80
......@@ -3,7 +3,7 @@
#define nlon 12 // Number of longitudes
#define nlat 6 // Number of latitudes
#define nlev 5 // Number of levels
#define nlev 1 // Number of levels
#define nts 3 // Number of time steps
int main(void)
......@@ -13,7 +13,7 @@ int main(void)
int i, nmiss = 0;
double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
double lats[nlat] = {-75, -45, -15, 15, 45, 75};
double levs[nlev] = {101300, 92500, 85000, 50000, 20000};
double levs[nlev] = {101300};
double var1[nlon*nlat];
double var2[nlon*nlat*nlev];
......@@ -36,7 +36,7 @@ int main(void)
vlistID = vlistCreate();
// Define the variables
varID1 = vlistDefVar(vlistID, gridID, zaxisID1, TSTEP_INSTANT);
varID1 = vlistDefVar(vlistID, gridID, zaxisID1, TSTEP_AVG);
varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TSTEP_INSTANT);
// Define the variable names
......@@ -65,8 +65,9 @@ int main(void)
// Loop over the number of time steps
for ( tsID = 0; tsID < nts; tsID++ )
{
// taxisDefFdate(taxisID, 19850101);
// taxisDefFtime(taxisID, 0);
taxisDefFdate(taxisID, 19850101);
taxisDefFtime(taxisID, 0);
taxisDefForecastPeriod(taxisID, 6);
// Set the verification date to 1985-01-01 + tsID
taxisDefVdate(taxisID, 19850101+tsID);
......
......@@ -55,6 +55,9 @@ const resOps taxisOps = {
taxisTxCode
};
#define RESH_ISCLOSED_TAXIS(taxisID) (reshGetStatus(taxisID, &taxisOps) == RESH_CLOSED)
#define RETURN_IF_CLOSED_TAXIS(taxisID) if ( RESH_ISCLOSED_TAXIS(taxisID) ) {Warning("%s", "Operation not executed."); return;}
static int TAXIS_Debug = 0; /* If set to 1, debugging */
......@@ -291,11 +294,7 @@ int taxisDuplicate(int taxisID1)
void taxisDefType(int taxisID, int type)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed." );
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -366,11 +365,7 @@ The function @func{taxisDefRdate} defines the reference date of a Time axis.
*/
void taxisDefRdate(int taxisID, int rdate)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed.");
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -395,11 +390,7 @@ The function @func{taxisDefRtime} defines the reference time of a Time axis.
*/
void taxisDefRtime(int taxisID, int rtime)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed.");
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -424,11 +415,7 @@ The function @func{taxisDefFdate} defines the forecast reference date of a Time
*/
void taxisDefFdate(int taxisID, int fdate)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed.");
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -453,11 +440,7 @@ The function @func{taxisDefFtime} defines the forecast reference time of a Time
*/
void taxisDefFtime(int taxisID, int ftime)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed.");
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -484,11 +467,7 @@ The function @func{taxisDefCalendar} defines the calendar of a Time axis.
*/
void taxisDefCalendar(int taxisID, int calendar)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed.");
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -500,11 +479,7 @@ void taxisDefCalendar(int taxisID, int calendar)
void taxisDefTunit(int taxisID, int unit)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed.");
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -516,11 +491,7 @@ void taxisDefTunit(int taxisID, int unit)
void taxisDefForecastTunit(int taxisID, int unit)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed.");
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -532,11 +503,7 @@ void taxisDefForecastTunit(int taxisID, int unit)
void taxisDefForecastPeriod(int taxisID, double fc_period)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed.");
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -548,11 +515,7 @@ void taxisDefForecastPeriod(int taxisID, double fc_period)
void taxisDefNumavg(int taxisID, int numavg)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed.");
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -587,11 +550,7 @@ int taxisHasBounds(int taxisID)
void taxisDeleteBounds(int taxisID)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed.");
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -673,11 +632,7 @@ void taxisInqVdateBounds(int taxisID, int *vdate_lb, int *vdate_ub)
void taxisDefVdateBounds(int taxisID, int vdate_lb, int vdate_ub)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed.");
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -728,11 +683,7 @@ void taxisInqVtimeBounds(int taxisID, int *vtime_lb, int *vtime_ub)
void taxisDefVtimeBounds(int taxisID, int vtime_lb, int vtime_ub)
{
if ( reshGetStatus ( taxisID, &taxisOps ) == RESH_CLOSED )
{
Warning("%s", "Operation not executed.");
return;
}
RETURN_IF_CLOSED_TAXIS(taxisID);
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......
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