WSL/SLF GitLab Repository

Commit 7d84e2a2 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Documentation improvements, fixed a bug when generating kml files (wrong...

Documentation improvements, fixed a bug when generating kml files (wrong altitude appended to the name), improved the layout when using smet_range and trying to convert average values to sums in GRIBIO for easier further processing.
parent 906eabee
......@@ -186,7 +186,6 @@ namespace mio {
* @code
* *::KEEP = TA RH ;all stations will keep TA and RH and reject the other parameters
* WFJ2::KEEP = HS PSUM ;WFJ2 will keep TA and RH as defined above but also HS and PSUM
*
* @endcode
*
* @subsection data_merging Data merging
......@@ -212,6 +211,8 @@ namespace mio {
* In order to avoid circular dependencies, a station can NOT receive data from a station AND contribute data to another station. Otherwise, a
* station can be merged into multiple other stations.
*
* \note The EXCLUDE directives are processed first, then the KEEP directives and finally the MERGE directives.
*
* @section virtual_stations_section Virtual stations
* It is possible to use spatially interpolated meteorological fields or time series of 2D grids to extract meteorological time series for a set of points.
* This is handled as "virtual stations" since the data will seem to originate from points where no station is present. This is described in the
......
......@@ -412,6 +412,12 @@ bool GRIBIO::read2DGrid_indexed(const double& in_marsParam, const long& i_levelT
getDate(h, base_date, P1, P2);
//see WMO code table5 for definitions of timeRangeIndicator. http://dss.ucar.edu/docs/formats/grib/gribdoc/timer.html
// 0 -> at base_date + P1
// 1 -> at base_date
// 2 -> valid between base_date+P1 and base_date+P2
// 3 -> average within [base_date+P1 , base_date+P2]
// 4 -> accumulation from base_date+P1 to base_date+P2
// 5 -> difference (base_date+P2) - (base_date+P1)
long timeRange;
GRIB_CHECK(grib_get_long(h,"timeRangeIndicator", &timeRange),0);
......@@ -424,6 +430,8 @@ bool GRIBIO::read2DGrid_indexed(const double& in_marsParam, const long& i_levelT
((timeRange==2 || timeRange==3) && i_date>=base_date+P1 && i_date<=base_date+P2) ||
((timeRange==4 || timeRange==5) && i_date==base_date+P2) ) {
read2Dlevel(h, grid_out);
if (timeRange==3) grid_out *= ((P2-P1)*24.*3600.); //convert avg to sum
grib_handle_delete(h);
return true;
}
}
......
......@@ -20,7 +20,7 @@ ls ${INPUT_DIR}/*.smet | xargs -i head -40 {} | awk '
}
/\[DATA\]/ {
printf("<Placemark>\n")
printf("<name>%s (%d)</name>\n", station_id, altitudes)
printf("<name>%s (%d)</name>\n", station_id, altitude)
printf("<styleUrl>#sty0</styleUrl>\n")
printf("<description>%s (%d)</description>\n", station_name, altitude)
printf("<Point><coordinates>%s, %s, %d</coordinates></Point>\n", longitude, latitude, altitude)
......
......@@ -35,7 +35,7 @@ if [ "${param}" = "time" ]; then
echo "${start} ${end} ${nr_lines}" | awk '
function getISO(ts){
return sprintf("%s", strftime("%FT%H:%m", (ts-2440587.5)*24*3600))
return sprintf("%s", strftime("%FT%H:%m:00", (ts-2440587.5)*24*3600))
}
function getSec(ts){
gsub(/\-|\:|T/," ", ts); split(ts,d," ");
......@@ -51,13 +51,13 @@ if [ "${param}" = "time" ]; then
ISO_end=getISO($2); ISO_start=getISO($1);
end=$2*24*3600; start=$1*24*3600; nr=$3
}
period=(end-start)/nr;
period=int( (end-start)/nr + 0.5); #round to the nearest second
if (period<299)
sampling=sprintf("%3.0f s", period)
sampling=sprintf("%3.0f s ", period)
else if (period<60*60)
sampling=sprintf("%3.0f min", period/60)
else if (period<24*3600)
sampling=sprintf("%3.0f h", period/3600)
sampling=sprintf("%3.0f h ", period/3600)
else
sampling=sprintf("%3.0f day", period/(3600*24))
printf( "%04d m\t[ %s - %s ]\t~%s\t(%s)\n", "'"${ALT}"'", ISO_start, ISO_end, sampling, "'"${NAME}"'")
......
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