TECA
The Toolkit for Extreme Climate Analysis
teca_calcalcs Namespace Reference

A threadsafe port of the calcalcs library. More...

Functions

int set_current_calendar (const char *calendar, const char *units)
 
int is_leap_year (const char *calendar, const char *units, int year, int &leap)
 
int days_in_month (const char *calendar, const char *units, int year, int month, int &dpm)
 
int date (double val, int *year, int *month, int *day, int *hour, int *minute, double *second, const char *dataunits, const char *calendar_name)
 
int coordinate (int year, int month, int day, int hour, int minute, double second, const char *user_unit, const char *calendar_name, double *value)
 

Detailed Description

A threadsafe port of the calcalcs library.

Function Documentation

◆ coordinate()

int teca_calcalcs::coordinate ( int  year,
int  month,
int  day,
int  hour,
int  minute,
double  second,
const char *  user_unit,
const char *  calendar_name,
double *  value 
)

given a year, month, day, hour, minute, second and calendar find the floating point offset. returns 0 upon success.

◆ date()

int teca_calcalcs::date ( double  val,
int *  year,
int *  month,
int *  day,
int *  hour,
int *  minute,
double *  second,
const char *  dataunits,
const char *  calendar_name 
)

Given a floating point offset in the given calendar return year, month, day, hour, minute, seconds. returns 0 upon success.

◆ days_in_month()

int teca_calcalcs::days_in_month ( const char *  calendar,
const char *  units,
int  year,
int  month,
int &  dpm 
)

Returns the days per month for the given year/month. Note that during the month that transitions from a Julian to a Gregorian calendar, this might be a strange number of days. this wraps ccs_dpm such that initialization is automatically handled and optimizes for repeat calls. returns 0 on success.

◆ is_leap_year()

int teca_calcalcs::is_leap_year ( const char *  calendar,
const char *  units,
int  year,
int &  leap 
)

Determine if the specified year is a leap year in the specified calendar. this wraps ccs_isleap such that initialization is automatically handled and optimizes for repeat calls.

Returns
0 if successful.

◆ set_current_calendar()

int teca_calcalcs::set_current_calendar ( const char *  calendar,
const char *  units 
)

high level thread safe initialize the library and select a calendar to use in subsequent calls. return 0 upon success