libdas2
das2 core C utilities
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Typedefs | Functions
units.h File Reference

Defines units used for items in the stream, most notably time units that reference an epoch and a step size. More...

Detailed Description

Defines units used for items in the stream, most notably time units that reference an epoch and a step size.

#include <stdbool.h>
#include <das2/time.h>

Go to the source code of this file.

Typedefs

typedef const char * das_units
 Enumeration of unit types, that correspond to physical unit types. More...
 

Functions

das_units Units_fromStr (const char *string)
 Basic constructor for das_unit's. More...
 
const char * Units_toStr (das_units unit)
 Get the canonical string representation of a das_unit Even though das_unit is a const char*, this function should be used in case the das_unit implementation is changed in the future. More...
 
char * Units_toLabel (das_units unit, char *sBuf, int nLen)
 Get label string representation das_units. More...
 
das_units Units_invert (das_units unit)
 Invert the units, most commonly used for Fourier transform results. More...
 
das_units Units_multiply (das_units ut1, das_units ut2)
 Combine units via multiplication. More...
 
das_units Units_divide (das_units a, das_units b)
 Combine units via division. More...
 
das_units Units_power (das_units unit, int power)
 Raise units to a power. More...
 
das_units Units_root (das_units unit, int root)
 Reduce units to a root. More...
 
das_units Units_interval (das_units unit)
 Get the unit type for intervals between data points of a given unit type. More...
 
das_units Units_reduce (das_units orig, double *pFactor)
 Reduce arbitrary units to the most basic know representation. More...
 
bool Units_canConvert (das_units fromUnits, das_units toUnits)
 Determine if given units are interchangeable Though not as good a solution as using UDUNITS2 works for common space physics quantities as well as SI units. More...
 
double Units_convertTo (das_units toUnits, double rVal, das_units fromUnits)
 Generic unit conversion utility. More...
 
bool Units_haveCalRep (das_units unit)
 Determine if the units in question can be converted to date-times. More...
 
void Units_convertToDt (das_time *pDt, double value, das_units epoch_units)
 Convert a value in time offset units to a calendar representation. More...
 
double Units_convertFromDt (das_units epoch_units, const das_time *pDt)
 Convert a calendar representation of a time to value in time offset units. More...
 
double Units_secondsSinceMidnight (double rVal, das_units epoch_units)
 Get seconds since midnight for some value of an epoch time unit. More...
 
bool Units_canMerge (das_units left, int op, das_units right)
 Determine if the units of values in a binary expression are compatable. More...