Commit a3f439ff authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added module EcaRainIndex

parent 74ec345d
......@@ -176,6 +176,10 @@ static const char CWD_NAME2[] = "number_of_cwd_periods_with_more_than_5da
static const char CWD_LONGNAME2[] = "Number of cwd periods in given time period with more than 5 days. The time period should be defined by the bounds of the time coordinate.";
static const char CWD_UNITS2[] = "No.";
static const char RINDEX_NAME[] = "precipitation_days_index_per_time_period";
static const char RINDEX_LONGNAME[] = "precipitation days is the number of days per time period with daily precipitation sum exceeding RR mm. The time period should be defined by the bounds of the time coordinate.";
static const char RINDEX_UNITS[] = "No.";
static const char R10MM_NAME[] = "heavy_precipitation_days_index_per_time_period";
static const char R10MM_LONGNAME[] = "Heavy precipitation days is the number of days per time period with daily precipitation sum exceeding 10 mm. The time period should be defined by the bounds of the time coordinate.";
static const char R10MM_UNITS[] = "No.";
......@@ -945,45 +949,57 @@ void *EcaCwd(void *argument)
}
void *EcaR10mm(void *argument)
void *EcaRainIndex(void *argument)
{
int ECA_RAININDEX, ECA_R10MM, ECA_R20MM;
int operatorID;
double rr = 0;
ECA_REQUEST_1 request;
cdoInitialize(argument);
cdoOperatorAdd("eca_r10mm", 0, 31, NULL);
request.var1.name = R10MM_NAME;
request.var1.longname = R10MM_LONGNAME;
request.var1.units = R10MM_UNITS;
request.var1.f1 = farselgec;
request.var1.f1arg = 10.0;
request.var1.f2 = farnum;
request.var1.f3 = NULL;
request.var1.mulc = 0.0;
request.var1.addc = 0.0;
request.var1.epilog = NONE;
request.var2.h2 = NULL;
request.var2.h3 = NULL;
eca1(&request);
cdoFinish();
return (0);
}
ECA_RAININDEX = cdoOperatorAdd("eca_rainindex", 0, 31, NULL);
ECA_R10MM = cdoOperatorAdd("eca_r10mm", 0, 31, NULL);
ECA_R20MM = cdoOperatorAdd("eca_r20mm", 0, 31, NULL);
void *EcaR20mm(void *argument)
{
ECA_REQUEST_1 request;
operatorID = cdoOperatorID();
if ( operatorID == ECA_RAININDEX )
{
operatorInputArg("RR");
if ( operatorArgc() < 1 ) cdoAbort("Not enough arguments!");
if ( operatorArgc() > 1 ) cdoAbort("Too many arguments!");
rr = atof(operatorArgv()[0]);
if ( rr < 0 ) cdoAbort("Parameter out of range: RR = %d", rr);
request.var1.name = RINDEX_NAME;
request.var1.longname = RINDEX_LONGNAME;
request.var1.units = RINDEX_UNITS;
}
else if ( operatorID == ECA_R10MM )
{
rr = 10;
request.var1.name = R10MM_NAME;
request.var1.longname = R10MM_LONGNAME;
request.var1.units = R10MM_UNITS;
}
else if ( operatorID == ECA_R20MM )
{
rr = 20;
request.var1.name = R20MM_NAME;
request.var1.longname = R20MM_LONGNAME;
request.var1.units = R20MM_UNITS;
}
cdoInitialize(argument);
cdoOperatorAdd("eca_r20mm", 0, 31, NULL);
if ( cdoVerbose ) cdoPrint("RR = %g", rr);
request.var1.name = R20MM_NAME;
request.var1.longname = R20MM_LONGNAME;
request.var1.units = R20MM_UNITS;
request.var1.f1 = farselgec;
request.var1.f1arg = 20.0;
request.var1.f1arg = rr;
request.var1.f2 = farnum;
request.var1.f3 = NULL;
request.var1.mulc = 0.0;
......@@ -991,7 +1007,7 @@ void *EcaR20mm(void *argument)
request.var1.epilog = NONE;
request.var2.h2 = NULL;
request.var2.h3 = NULL;
eca1(&request);
cdoFinish();
......
......@@ -219,8 +219,7 @@ void *EcaTx90p(void *argument);
void *EcaCdd(void *argument);
void *EcaCwd(void *argument);
void *EcaRr1(void *argument);
void *EcaR10mm(void *argument);
void *EcaR20mm(void *argument);
void *EcaRainIndex(void *argument);
void *EcaR75p(void *argument);
void *EcaR75ptot(void *argument);
void *EcaR90p(void *argument);
......@@ -454,6 +453,7 @@ void *Wct(void *argument);
#define EcaCddOperators {"eca_cdd"}
#define EcaCwdOperators {"eca_cwd"}
#define EcaRr1Operators {"eca_rr1"}
#define EcaRainIndexOperators {"eca_rainindex"}
#define EcaR10mmOperators {"eca_r10mm"}
#define EcaR20mmOperators {"eca_r20mm"}
#define EcaR75pOperators {"eca_r75p"}
......@@ -682,8 +682,9 @@ static modules_t Modules[] =
{ EcaCdd, EcaCddHelp, EcaCddOperators, CDI_REAL, 1, 1 },
{ EcaCwd, EcaCwdHelp, EcaCwdOperators, CDI_REAL, 1, 1 },
{ EcaRr1, EcaRr1Help, EcaRr1Operators, CDI_REAL, 1, 1 },
{ EcaR10mm, EcaR10mmHelp, EcaR10mmOperators, CDI_REAL, 1, 1 },
{ EcaR20mm, EcaR20mmHelp, EcaR20mmOperators, CDI_REAL, 1, 1 },
{ EcaRainIndex, NULL, EcaRainIndexOperators, CDI_REAL, 1, 1 },
{ EcaRainIndex, EcaR10mmHelp, EcaR10mmOperators, CDI_REAL, 1, 1 },
{ EcaRainIndex, EcaR20mmHelp, EcaR20mmOperators, CDI_REAL, 1, 1 },
{ EcaR75p, EcaR75pHelp, EcaR75pOperators, CDI_REAL, 2, 1 },
{ EcaR75ptot, EcaR75ptotHelp, EcaR75ptotOperators, CDI_REAL, 2, 1 },
{ EcaR90p, EcaR90pHelp, EcaR90pOperators, CDI_REAL, 2, 1 },
......
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