00001 #ifndef _WINC_CALC
00002 #define _WINC_CALC
00003
00004 #include <WXP/Const.h>
00005 #include <WXP/LclData.h>
00006
00007 namespace WXP {
00008 class Calc {
00009 public:
00010 static float windSpd( float u, float v );
00011 static float windDir( float u, float v );
00012 static float windU( float dir, float spd );
00013 static float windV( float dir, float spd );
00014 static float vaporPres( float t );
00015 static float windChillTemp( float temp, float ws );
00016 static float windChillTemp2( float temp, float ws );
00017 static float windChill( float temp, float ws );
00018 static float heatIndex( float temp, float dewp );
00019 static float humiture( float temp, float dewp );
00020 static float tempHumIndex( float temp, float dewp );
00021 static float sfcPrAlt( float alt, float el );
00022 static float presAlt( float pres );
00023 static float mixRatio( float temp, float pr );
00024 static float specHum( float temp, float pr );
00025 static float dewTemp( float temp, float rh );
00026 static float potTemp( float temp, float pr );
00027 static float virtTemp( float temp, float dewp, float pr );
00028 static float virtPotTemp( float temp, float dewp, float pr );
00029 static float tempOnSatAd( float pot, float pr );
00030 static float tempOnDryAd( float pot, float pr );
00031 static float thetaeOnSatAd( float temp, float pr );
00032 static float tempVaporPres( float e );
00033 static float tempOnMixRat( float w, float pr );
00034 static float relHum( float t, float td );
00035 static float convTemp( float wbar, float pc, float pr );
00036 static float lclPres( float ts, float tds, float ps);
00037 static float lclTemp( float ts, float ps, float plcl);
00038 static int lcl( float ts, float tds, float ps, LclData &ldat );
00039 static LclData lcl( float ts, float tds, float ps);
00040 static float eqPotTemp( float temp, float dewp, float pr );
00041 static float wetBulb( float temp, float dewp, float pr );
00042 static float wetBulbPotTemp( float temp, float dewp, float pr );
00043 static float interpLinear( float x,float x1,float x2,float y1,float y2 );
00044 static float interpTemp( float t1, float t2, float p1, float p2, float pr);
00045 static float earthDist( float lat1, float lon1, float lat2, float lon2);
00046 static float earthAngle( float lat1, float lon1, float lat2, float lon2);
00047 static float dist( float x1, float y1, float x2, float y2);
00048
00050 static inline float Min( float x, float y ){
00051 return x < y ? x : y;}
00053 static inline float Max( float x, float y ){
00054 return x > y ? x : y;}
00055
00057 static inline float ADD( float x, float y ){
00058 return x != Const::MISS && y != Const::MISS ? x+y : Const::MISS;}
00060 static inline float DIF( float x, float y ){
00061 return x != Const::MISS && y != Const::MISS ? x-y : Const::MISS;}
00063 static inline float MUL( float x, float y ){
00064 return x != Const::MISS && y != Const::MISS ? x*y : Const::MISS;}
00066 static inline float DIV( float x, float y ){
00067 return x != Const::MISS && y != Const::MISS ? x/y : Const::MISS;}
00068 };
00069 }
00070 #endif