Skip to content

Commit

Permalink
Adds probability of precip (Pop) variable
Browse files Browse the repository at this point in the history
  • Loading branch information
tnipen committed Jun 22, 2015
1 parent c6e4ec3 commit 92463e7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/File/Arome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ std::string FileArome::getVariableName(Variable::Type iVariable) const {
else if(iVariable == Variable::Precip) {
return "precipitation_amount";
}
else if(iVariable == Variable::Pop) {
return "precipitation_amount_prob_low";
}
else if(iVariable == Variable::U) {
return "x_wind_10m";
}
Expand Down
28 changes: 21 additions & 7 deletions src/Variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ std::string Variable::getTypeName(Type iType) {
return "Precip";
else if(iType == PrecipAcc)
return "PrecipAcc";
else if(iType == Pop)
return "Pop";
else if(iType == Cloud)
return "Cloud";
else if(iType == T)
Expand Down Expand Up @@ -40,6 +42,8 @@ Variable::Type Variable::getType(std::string iName) {
return Precip;
else if(iName == "PrecipAcc")
return PrecipAcc;
else if(iName == "Pop")
return Pop;
else if(iName == "Cloud")
return Cloud;
else if(iName == "T")
Expand Down Expand Up @@ -73,6 +77,7 @@ std::string Variable::description() {
ss << Util::formatDescription("-v T", "Temperature") << std::endl;
ss << Util::formatDescription("-v Precip", "Hourly precip") << std::endl;
ss << Util::formatDescription("-v PrecipAcc", "Accumulated precip") << std::endl;
ss << Util::formatDescription("-v Pop", "Probability of precip") << std::endl;
ss << Util::formatDescription("-v W", "Wind speed") << std::endl;
ss << Util::formatDescription("-v WD", "Wind direction") << std::endl;
ss << Util::formatDescription("-v U", "U-wind") << std::endl;
Expand All @@ -90,6 +95,7 @@ std::vector<Variable::Type> Variable::getAllVariables() {
std::vector<Type> variables;
variables.push_back(Variable::T);
variables.push_back(Variable::PrecipAcc);
variables.push_back(Variable::Pop);
variables.push_back(Variable::Precip);
variables.push_back(Variable::W);
variables.push_back(Variable::WD);
Expand All @@ -108,9 +114,11 @@ float Variable::getMin(Type iType) {
switch(iType) {
case T:
return 0;
case Precip:
return 0;
case PrecipAcc:
return 0;
case Precip:
case Pop:
return 0;
case W:
return 0;
Expand Down Expand Up @@ -141,10 +149,12 @@ float Variable::getMax(Type iType) {
switch(iType) {
case T:
return Util::MV;
case PrecipAcc:
return Util::MV;
case Precip:
return Util::MV;
case PrecipAcc:
return Util::MV;
case Pop:
return 1;
case W:
return Util::MV;
case WD:
Expand Down Expand Up @@ -173,10 +183,12 @@ std::string Variable::getUnits(Type iType) {
switch(iType) {
case T:
return "K";
case PrecipAcc:
return "kg/m^2";
case Precip:
return "kg/m^2";
case PrecipAcc:
return "kg/m^2";
case Pop:
return "1";
case W:
return "m/s";
case WD:
Expand All @@ -188,7 +200,7 @@ std::string Variable::getUnits(Type iType) {
case Cloud:
return "1";
case RH:
return "%";
return "1";
case Phase:
return "";
case P:
Expand All @@ -205,9 +217,11 @@ std::string Variable::getStandardName(Type iType) {
switch(iType) {
case T:
return "air_temperature";
case Precip:
return "precipitation_amount";
case PrecipAcc:
return "precipitation_amount_acc";
case Precip:
case Pop:
return "precipitation_amount";
case W:
return "wind_speed";
Expand Down
1 change: 1 addition & 0 deletions src/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Variable {
enum Type {
Precip = 0, // Hourly amount ending at the specified time
PrecipAcc = 1, // Accumulated ending at the specified time
Pop = 2, // Probability of precipitation
Cloud = 10, // Cloud cover (between 0 and 1)
T = 20, // 2m temperature (K)
U = 30, // 10m U-wind (m/s)
Expand Down

0 comments on commit 92463e7

Please sign in to comment.