WSL/SLF GitLab Repository

Commit 907a717e authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Several bugs have been fixed: in the AllSky generator, the cloudiness was...

Several bugs have been fixed: in the AllSky generator, the cloudiness was still forced to 0.5 (as for debug). The data creators were also called *after* the generators, thus making it impossible to used a created data in a generator. 

The placeholders have been put in place (but commented out) for the cloudiness/tau_cloud/clearness index support in MeteoData. It seems that Kt=clearness index might be the proper way to go, but this is still a messy field. Some comments have been added in the code to clarify the use of such parameters.
parent 87b55e1d
......@@ -315,9 +315,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=0.5; //HACK: read cloudiness from meteoData!
cloudiness=IOUtils::nodata;
double cloudiness = (md.param_exists("TAU_CLD"))? Atmosphere::Kasten_cloudiness( md("TAU_CLD") ) : IOUtils::nodata;
const string station_hash = md.meta.stationID + ":" + md.meta.stationName;
const double julian_gmt = md.date.getJulian(true);
......
......@@ -193,8 +193,8 @@ size_t IOManager::getMeteoData(const Date& dateStart, const Date& dateEnd, std::
}
if ((IOManager::generated & processing_level) == IOManager::generated){
dataGenerator.fillMissing(vecVecMeteo);
dataGenerator.createParameters(vecVecMeteo);
dataGenerator.fillMissing(vecVecMeteo);
}
}
......@@ -321,9 +321,9 @@ size_t IOManager::getTrueMeteoData(const Date& i_date, METEO_SET& vecMeteo)
}
}
if ((IOManager::generated & processing_level) == IOManager::generated){
dataGenerator.fillMissing(vecMeteo);
if ((IOManager::generated & processing_level) == IOManager::generated) {
dataGenerator.createParameters(vecMeteo);
dataGenerator.fillMissing(vecMeteo);
}
return vecMeteo.size();
......
......@@ -42,6 +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("HS");
paramname.push_back("HNW");
paramname.push_back("TSG");
......@@ -92,6 +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[HNW] = "HNW";
s_default_paramname.push_back("P");
......@@ -106,6 +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("HNW");
return true;
......
......@@ -54,6 +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
HS, ///< Height of snow
HNW, ///< Water equivalent of precipitations, either solid or liquid
TSG, ///< Temperature ground surface
......@@ -112,6 +113,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
HNW, ///< Water equivalent (water depth) of precipitations, either solid or liquid
lastparam=HNW};
......
......@@ -294,7 +294,7 @@ double SunObject::getSplitting(const double& iswr_modeled, const double& iswr_me
splitting_coef = 1.0;
} else {
// clear sky index (ratio global measured to top of atmosphere radiation)
const double Mt = iswr_measured / iswr_modeled; // should be <=1.2
const double Mt = iswr_measured / iswr_modeled; // should be <=1.2, aka clearness index Kt
const double clear_sky = 0.147;
// diffuse fraction: hourly ratio of diffuse to global radiation incident on a horizontal surface
......
......@@ -309,8 +309,10 @@ void CosmoXMLIO::readAssimilationData(const Date& /*date_in*/, Grid2DObject& /*d
bool CosmoXMLIO::parseStationData(const std::string& station_id, const xmlXPathContextPtr& xpathCtx, StationData &sd)
{
//match something like "//ns:valueinformation/ns:values-tables/ns:data/ns:row/ns:col[@id='station_abbreviation' and text()='ATT']/.."
//the namespace "ns" has been previously defined
const std::string xpath_id = (imis_stations)? station_id.substr(0, station_id.find_first_of("0123456789")) : station_id;
const std::string xpath = StationData_xpath+"[@id='station_abbreviation' and text()='"+xpath_id+"']/.."; //ie parent node containing the pattern
const std::string xpath = StationData_xpath+"[@id='station_abbreviation' and text()='"+xpath_id+"']/.."; //and we take the parent node <row>
xmlXPathObjectPtr xpathObj = xmlXPathEvalExpression((const xmlChar*)xpath.c_str(), xpathCtx);
if(xpathObj == NULL) return false;
......
......@@ -609,7 +609,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::ISWR) {
} /*else if(parameter==MeteoGrids::TAU_CLD) {
if(!autoscale) {
min = 0.; max = 1.;
}
gradient.set(Gradient::blktowhite, min, max, autoscale);
}*/ 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