Giter Site home page Giter Site logo

sherzodr / libpenmon Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 351 KB

Implements weather station class in C++ that calculates ETo based on Penman-Monteith equation

License: MIT License

Makefile 6.32% C++ 4.90% Shell 88.71% M4 0.07%
penman-monteith-equation station hydrology fao eto science-research atmospheric-science weather-station penman-monteith reference-crop

libpenmon's Introduction

NAME

libpenmon - Implements weather station in C++ that supports ETo calculation.

SYNOPSIS

#include "libpenmon.h"
#include <iostream>

int main(void) {
    Station station(41.42, 109);
    StationDay day238 = station.day(238, station);
    day238.temp_min=19.5;
    day238.temp_max=29.5;
    std::cout << "ETo is " << day238.eto() << "mm\n";
    return 0;
}

WARNING

This library is work-in-progress. Proceed with caution!

INSTALL

./configure
make
make install

It also includes example.cpp file. You can compile the program by doing:

make example

It will generate an executable file example in your current folder.

LINKING WITH LIBPENMON

This is how I compile and link source code that uses libpenmon:

g++ source_code.cpp -lpenmon

If compiler complains saying -lpenmon is not found, you should provide the library path where you installed it:

g++ -L"your/lib/path" source_code.cpp -lpenmon

In case it cannot find libpenmon.h header file, direct it to the location of the header file:

g++ -I"your/include/path" -L"your/libpath" source_code.cpp -lpenmon 

DESCRIPTION

Implements a weather station class (Station) that calculates ETo (reference evapotranspiration) given climate data. Based on Penman-Monteith equation as detailed in UN-FAO's "Irrigation and Drainage Paper 56".

CLASSES

libpenmon implements few classes to accomplish it's mission as intuitively as possible:

Station

This is the main class that holds other classes together. It can either accept two arguments, latitude and altitude of the location:

Station station_in_uzb(41.42, 109)

or three arguments, latitude, altitude and anemometer_height:

Station station_in_uzb(41.42, 109, 10)

If the third argument is missing it defaults to 2

StationDay

This class represents a single entry related to the Station. All of the heavy-lifting happens in this class. It's also responsiblel to calculate ETo:

StationDay day138=station_in_uzb.get_day(138);
day138.temp_min=26.5;
day138.temp_max=38.5

float eto = day138.eto();

Crop

This class represents a crop, against which evapotranspiration is calculated. if you do not set any crop details library defaults to reference crop as detailed in the original paper.

Client

Algorithms detailed in the paper are able to make assumptions regarding the climate to recreate missing data. To make these assumptions it relies on Client class. If you do not instantiate this class it creates a default climate class.

SEE ALSO

libpenmon started off as a port of penmon.eto Python module. You should refer to that module to learn more about this library. Method and classnames are preserved as is.

AUTHOR

Sherzod B. Ruzmetov [email protected]

libpenmon's People

Contributors

sherzodr avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.