WSL/SLF GitLab Repository

Commit 07fadabc authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Adding a new meteo parameter: the cloud transmissivity TAU_CLD defined as...

Adding a new meteo parameter: the cloud transmissivity TAU_CLD defined as iswr_meas / iswr_clear_sky (ie the potential radiation computed at ground level with a standard atmosphere, see Iqbal 1983). This parameter is already used by the AllSky_LW and PotRad generators and properly handled by the PNG plugin. The PNG plugin can now also properly output a hillshade (as MeteoGrids::SHADE).
parent bc4e2fca
......@@ -384,7 +384,7 @@ bool AllSkyLWGenerator::generate(const size_t& param, MeteoData& md)
if (value==IOUtils::nodata) {
const double TA=md(MeteoData::TA), RH=md(MeteoData::RH);
if (TA==IOUtils::nodata || RH==IOUtils::nodata) return false;
double cloudiness = (md.param_exists("TAU_CLD"))? Atmosphere::Kasten_cloudiness( md("TAU_CLD") ) : IOUtils::nodata;
double cloudiness = (md.param_exists("TAU_CLD"))? Atmosphere::Kasten_cloudiness( 1.-md("TAU_CLD") ) : IOUtils::nodata;
const string station_hash = md.meta.stationID + ":" + md.meta.stationName;
const double julian_gmt = md.date.getJulian(true);
......@@ -465,7 +465,7 @@ bool PotRadGenerator::generate(const size_t& param, MeteoData& md)
{
double &value = md(param);
if(value == IOUtils::nodata) {
const double ISWR=md(MeteoData::ISWR), RSWR=md(MeteoData::RSWR), HS=md(MeteoData::HS);
const double ISWR=md(MeteoData::ISWR), RSWR=md(MeteoData::RSWR), HS=md(MeteoData::HS), TAU_CLD=md(MeteoData::TAU_CLD);
double TA=md(MeteoData::TA), RH=md(MeteoData::RH), ILWR=md(MeteoData::ILWR);
const double lat = md.meta.position.getLat();
......@@ -492,7 +492,7 @@ bool PotRadGenerator::generate(const size_t& param, MeteoData& md)
sun.setLatLon(lat, lon, alt);
sun.setDate(md.date.getJulian(true), 0.);
const double solarIndex = (ILWR!=IOUtils::nodata)? getSolarIndex(TA, RH, ILWR) : 1.;
const double solarIndex = (TAU_CLD!=IOUtils::nodata)? TAU_CLD : (ILWR!=IOUtils::nodata)? getSolarIndex(TA, RH, ILWR) : 1.;
const double P=md(MeteoData::P);
if(P==IOUtils::nodata)
......
......@@ -42,7 +42,7 @@ bool MeteoGrids::initStaticData()
paramname.push_back("ISWR");
paramname.push_back("RSWR");
paramname.push_back("ILWR");
//paramname.push_back("TAU_CLD");
paramname.push_back("TAU_CLD");
paramname.push_back("HS");
paramname.push_back("HNW");
paramname.push_back("TSG");
......@@ -93,7 +93,7 @@ bool MeteoData::initStaticData()
static_meteoparamname[RSWR] = "RSWR";
static_meteoparamname[ISWR] = "ISWR";
static_meteoparamname[ILWR] = "ILWR";
//static_meteoparamname[TAU_CLD]= "TAU_CLD";
static_meteoparamname[TAU_CLD]= "TAU_CLD";
static_meteoparamname[HNW] = "HNW";
s_default_paramname.push_back("P");
......@@ -108,7 +108,7 @@ bool MeteoData::initStaticData()
s_default_paramname.push_back("RSWR");
s_default_paramname.push_back("ISWR");
s_default_paramname.push_back("ILWR");
//s_default_paramname.push_back("TAU_CLD");
s_default_paramname.push_back("TAU_CLD");
s_default_paramname.push_back("HNW");
return true;
......
......@@ -54,7 +54,7 @@ class MeteoGrids {
ISWR, ///< Incoming short wave radiation
RSWR, ///< Reflected short wave radiation
ILWR, ///< Incoming long wave radiation
//TAU_CLD, ///< Cloud transmissivity, or ISWR/ISWR_clear_sky, aka solar index
TAU_CLD, ///< Cloud transmissivity or ISWR/ISWR_clear_sky
HS, ///< Height of snow
HNW, ///< Water equivalent of precipitations, either solid or liquid
TSG, ///< Temperature ground surface
......@@ -67,6 +67,7 @@ class MeteoGrids {
ROT, ///< Total generated runoff
ALB, ///< Albedo
DEM, ///< Digital Elevation Model
SHADE, ///< Hillshade
SLOPE, ///< DEM slope angle
AZI, ///< DEM slope azimuth
lastparam=AZI};
......@@ -106,7 +107,7 @@ class MeteoData {
RSWR, ///< Reflected short wave radiation
ISWR, ///< Incoming short wave radiation
ILWR, ///< Incoming long wave radiation (downwelling)
//TAU_CLD, ///< Cloud transmissivity, or ISWR/ISWR_clear_sky, aka solar index
TAU_CLD, ///< Cloud transmissivity or ISWR/ISWR_clear_sky
HNW, ///< Water equivalent (water depth) of precipitations, either solid or liquid
lastparam=HNW};
......
......@@ -553,6 +553,11 @@ void PNGIO::write2DGrid(const Grid2DObject& grid_in, const MeteoGrids::Parameter
gradient.set(Gradient::terrain, min, max, autoscale);
} else if(parameter==MeteoGrids::SLOPE) {
gradient.set(Gradient::slope, min, max, autoscale);
} else if(parameter==MeteoGrids::SHADE) {
if(!autoscale) {
min = 0.; max = 1.;
}
gradient.set(Gradient::blktowhite, min, max, autoscale);
} else if(parameter==MeteoGrids::AZI) {
if(!autoscale) {
min = 0.;
......@@ -609,12 +614,12 @@ void PNGIO::write2DGrid(const Grid2DObject& grid_in, const MeteoGrids::Parameter
min = 0.; max = 1.;
}
gradient.set(Gradient::blktowhite, min, max, autoscale);
} /*else if(parameter==MeteoGrids::TAU_CLD) {
} else if(parameter==MeteoGrids::TAU_CLD) {
if(!autoscale) {
min = 0.; max = 1.;
}
gradient.set(Gradient::blktowhite, min, max, autoscale);
}*/ else if(parameter==MeteoGrids::ISWR) {
} else if(parameter==MeteoGrids::ISWR) {
if(!autoscale) {
min = 0.; max = 800.;
}
......
Supports Markdown
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