WSL/SLF GitLab Repository

Commit 6b0b35c6 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

The demo program (meteoio_demo.cc) has been cleaned up with its Makefile.

More doxygen documentation has been written (Thomas, you're invited to contribute!!)
parent de494d47
#include "FilterAlgorithms.h"
/**
* @page filters Filters overview
* The filtering infrastructure is described in FilterAlgorithms (for its API). The goal of this page is to give an overview of the available filters and their usage.
*
* @section filters_modes Modes of operation
* It should be noted that filters often have two modes of operations: soft or hard. In soft mode, all value that is rejected is replaced by the filter parameter's value. This means that for a soft min filter set at 0.0, all values less than 0.0 will be replaced by 0.0. In hard mode, all rejected values are replaced by nodata.
*
* @section filters_available Available filters
* The filters that are currently available are the following:
* - rate: calculates the derivative at the current point and reject the point if the derivative is above a given threshold.
* - min_max: filter all values outside of the interval [min, max], soft operation supported
* - min: filter out all values less than the given parameter, soft operation supported
* - max: filter out all values greater than the given parameter, soft operation supported
*
* A few data transformations are also supported besides filtering:
* - resample: resamples (if necessary) the data so that if a required time stamp is between two data points, an interpolated value will be returned (instead of nodata).
* - accumulation: accumulates the data on a given period. A practical use is to return hourly precipitations from a sensor measuring precipitation on a 10 minutes interval.
*/
std::map<std::string, FilterProperties> FilterAlgorithms::filterMap;
const bool FilterAlgorithms::__init = FilterAlgorithms::initStaticData();
......
......@@ -84,11 +84,7 @@
*/
//Plugins overview given in IOHandler.cc
/**
* @page filters Filters overview
*
*/
//Filters overview given in FilterAlgorithms.cc
/**
* @page dev_plugins Plugins developer's guide
......
CC=g++ -DGNU
A3DROOT=../..
CFLAGS=-Wall -Wextra
CC =g++ -DGNU
CFLAGS = -Wall -Wextra
DEBUG = -g -O0 -DDEBUG -ggdb
POPCC = popcc
METEOIODIR = ../src
METEOIODIR = ../src
FILTERDIR = $(METEOIODIR)/filter
LIBS = -rdynamic -lstdc++ -ldl -L../lib -lmeteoio
LIBS_POPC = -L../lib -lstdc++ -lmeteoiopopc
vpath %.h $(METEOIODIR) $(FILTERDIR) ./
vpath %.c $(METEOIODIR) $(FILTERDIR) ./
vpath %.cc $(METEOIODIR) $(FILTERDIR) ./
INCLUDE=-I. -I$(METEOIODIR)
INCLUDE_POPC=-I. -I$(METEOIODIR)
LIBS =-rdynamic -lstdc++ -ldl -L../lib -lmeteoio -lfilter
LIBS_POPC=-L../ -L../lib -L$(A3DROOT)/snowpack -L$(A3DROOT)/common -lstdc++ -lcommonpopc -lfilterpopc -lmeteoiopopc -lsnowpackpopc
#####################
# RULES
#####################
.cc.o: $*.cc $*.h
$(CC) $(DEBUG) $(CFLAGS) -c $< $(INCLUDE)
DEBUG = -g -O0 -DDEBUG -ggdb
INCLUDE=-I. -I$(METEOIODIR) -I$(FILTERDIR)
%.o: %.cc
$(CC) $(DEBUG) $(CFLAGS) -c $< $(INCLUDE)
INCLUDE_POPC=-I. -I$(METEOIODIR) -I$(FILTERDIR) -I$(A3DROOT)/snowpack/ -I$(A3DROOT)/snowpack/snowpack_core/ -I$(A3DROOT)/common/ $(shell pkg-config --cflags libxml++-2.6) -I$(A3DROOT)/snowdrift
%_par.o : %.cc
$(POPCC) $(DEBUG) $(CFLAGS) -c $< $(INCLUDE_POPC) -o $@
%.stub.o : %.ph
$(POPCC) $(DEBUG) $(CFLAGS) -c $< $(INCLUDE_POPC) -o $@
#####################
# TARGETS
#####################
seq: meteoio_demo
demo: meteoio_demo
.cc.o: $*.cc $*.h
$(CC) $(DEBUG) $(CFLAGS) -c $< $(INCLUDE)
%.o: %.cc
$(CC) $(DEBUG) $(CFLAGS) -c $< $(INCLUDE)
par: meteoio_demo.popc
testDate: testDate.o ../lib/libmeteoio.a
cd ../; make
......@@ -38,10 +44,12 @@ testMeteo: MeteoData.o Date.o testMeteo.o slfutils.o makeLib
testStation: StationData.o testStation.o
g++ -o testStation StationData.o testStation.o
#testFile: testFile.o makeLib
meteoio_demo: meteoio_demo.o
$(CC) $(DEBUG) -o $@ meteoio_demo.o ${LIBS}
meteoio_demo.popc: meteoio_demo_par.o
$(POPCC) $(DEBUG) -o $@ meteoio_demo_par.o ${LIBS_POPC}
testThomas: testThomas.o ../lib/libmeteoio.a
cd ../; make
$(CC) $(DEBUG) -rdynamic -o $@ testThomas.o ${LIBS}
......@@ -52,17 +60,6 @@ sensorscope: sensorscope.o ../lib/libmeteoio.a
testConfigReader: main.o ConfigReader.o slfutils.o slfexceptions.o
$(CC) -o $@ main.o ConfigReader.o slfutils.o slfexceptions.o
par: meteoio_demo.popc
%_par.o : %.cc
$(POPCC) $(DEBUG) $(CFLAGS) -c $< $(INCLUDE_POPC) -o $@
%.stub.o : %.ph
$(POPCC) $(DEBUG) $(CFLAGS) -c $< $(INCLUDE_POPC) -o $@
meteoio_demo.popc: meteoio_demo_par.o
$(POPCC) $(DEBUG) -o $@ meteoio_demo_par.o ${LIBS_POPC}
clean:
rm -rf *~ *.o libslfio.a main testThomas meteoio_demo testDate testConfigReader testMeteo testStation meteoio_demo.popc *.out testArray sensorscope
rm -rf *~ *.o main testThomas meteoio_demo testDate testConfigReader testMeteo testStation meteoio_demo.popc *.out testArray sensorscope
......@@ -4,6 +4,8 @@
using namespace std;
int main(int argc, char** argv) {
//provide date as ISO formatted, for example 2008-12-01T15:35:00
//please look in the online documentation for more code examples!!
(void)argc;
Date_IO d1;
......@@ -20,7 +22,7 @@ int main(int argc, char** argv) {
BufferedIOHandler *io = NULL;
try {
ConfigReader cfg("io.ini");
ConfigReader cfg("io_demo.ini");
raw_io = new IOHandler(cfg);
io = new BufferedIOHandler(*raw_io, cfg);
} catch (IOException& e){
......@@ -38,41 +40,8 @@ int main(int argc, char** argv) {
cout << "---------- Station: " << (ii+1) << " / " << vecStation.size() << endl;
cout << vecStation[ii].toString() << endl;
cout << vecMeteo[ii].toString() << endl;
//cout << " Name: " << vecStation[ii].getStationName() << endl;
//cout << " RH: " << vecMeteo[ii].rh << endl;
}
//And now, doing spatial interpolations
DEMObject dem;
io->readDEM(dem);
dem.update(DEMObject::CORR);
//convert to local grid coordinates, an elegant way of dealing with multiple coordinates systems inputs
dem.xllcorner = 0.;
dem.yllcorner = 0.;
for (unsigned i = 0; i < vecMeteo.size() ; ++i) {
//setup reference station, convert coordinates to local grid
IOUtils::WGS84_to_local(dem.latitude, dem.longitude, vecStation[i].latitude, vecStation[i].longitude, vecStation[i].eastCoordinate, vecStation[i].northCoordinate);
}
Grid2DObject p(dem.ncols, dem.nrows, dem.xllcorner, dem.yllcorner, dem.latitude, dem.longitude, dem.cellsize);
Grid2DObject nswc(dem.ncols, dem.nrows, dem.xllcorner, dem.yllcorner, dem.latitude, dem.longitude, dem.cellsize);
Grid2DObject vw(dem.ncols, dem.nrows, dem.xllcorner, dem.yllcorner, dem.latitude, dem.longitude, dem.cellsize);
Grid2DObject rh(dem.ncols, dem.nrows, dem.xllcorner, dem.yllcorner, dem.latitude, dem.longitude, dem.cellsize);
Grid2DObject ta(dem.ncols, dem.nrows, dem.xllcorner, dem.yllcorner, dem.latitude, dem.longitude, dem.cellsize);
Meteo2DInterpolator mi(dem, vecMeteo, vecStation);
mi.interpolate(nswc, rh, ta, vw, p);
cout << "Writing the Grids to *.2d files" << endl;
io->write2DGrid(ta, "output/ta.2d");
io->write2DGrid(p, "output/p.2d");
io->write2DGrid(vw, "output/vw.2d");
io->write2DGrid(nswc, "output/nswc.2d");
io->write2DGrid(rh, "output/rh.2d");
cout << "Writing the Grids was successful" << endl;
delete io;
delete raw_io;
......
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