OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
met_cvt.h
Go to the documentation of this file.
1 /*******************************************************************
2 
3  met_cvt.h
4 
5  purpose: include file for the use of the meteorological conversion
6  routines
7 
8  Parameters:
9  Type Name I/O Description
10  ---- ---- --- -----------
11 
12  Modification history:
13  Programmer Date Description of change
14  ---------- ---- ---------------------
15  W. Robinson, SAIC 12-Mar-2009 Original development
16  W. Robinson, SAIC 5 Aug 2013 rename for met_cvt
17 
18  *******************************************************************/
19 
20 #include <math.h>
21 /*
22  * set up some definitions met data units
23  */
24 #define MET_UNITS__P_PA 0 /* Pressure in Pascals */
25 #define MET_UNITS__P_HPA 1 /* Pressure in Hectopascals */
26 #define MET_UNITS__T_K 10 /* Temperature in deg K */
27 #define MET_UNITS__T_C 11 /* Temperature in deg C */
28 #define MET_UNITS__Q_KG_KG 20 /* Specific humidity in Kg / Kg */
29 #define MET_UNITS__Q_G_KG 21 /* Specific humidity in g / Kg */
30 
31 /*
32  * common physical constants
33  */
34 #define M_DRY 28.9644 /* molar mass of dry air */
35 #define M_WET 18.01534 /* molar mass of water */
36 #define C_IN_K 273.15 /* the value of 0 C in K */
37 #define R_W 461.5 /* gas constanr for water vapor in K^-1 kg^-1 */
38 #define L_ENTHALPY 2.38e6 /* enthalpy of vaporization (varies from
39  2.501 at 273.15K to 2.257 at 373.15) */
40 #define MAGNUS_A1 17.625 /* the A1 value for the Magnus equation for es */
41 #define MAGNUS_B1 243.04 /* the B1 value for the Magnus equation for es */
42 /* coefficients for computing saturated vapor pressure */
43 static const double es_coef_wet[] = {6.107799961, 4.436518521e-1, 1.428945805e-2,
44  2.650648471e-4, 3.031240396e-6, 2.034080948e-8, 6.136820929e-11};
45 static const double es_coef_ice[] = {6.109177956, 5.034698970e-1, 1.886013408e-2,
46  4.176223716e-4, 5.824720280e-6, 4.838803174e-8, 1.838826904e-10 };
47 /*
48  * standard pressure level set
49  */
50 static const float std_p_lvls_42[] = {1000., 975., 950., 925., 900., 875., 850.,
51  825., 800., 775., 750., 725., 700., 650., 600., 550., 500., 450., 400.,
52  350., 300., 250., 200., 150., 100., 70., 50., 40., 30., 20., 10., 7., 5.,
53  4., 3., 2., 1., 0.7, 0.5, 0.4, 0.3, 0.1};
54 /*
55  * prototypes
56  */
57 int met_cvt_q_to_rh(int, float *, int, float *, int, float *, int, float *);
58 int met_cvt_rh_to_q( int, float *, int, float *, int, float *, float *, int);
59 double met_cvt_p_cvt(double, int, int);
60 double met_cvt_t_cvt(double, int, int);
61 double met_cvt_q_cvt(double, int, int);
62 int met_cvt_ttd_to_rh(int, float *, int, float *, int, float *);
double met_cvt_p_cvt(double, int, int)
Definition: met_cvt.c:236
int met_cvt_ttd_to_rh(int, float *, int, float *, int, float *)
Definition: met_cvt.c:182
double met_cvt_q_cvt(double, int, int)
Definition: met_cvt.c:314
int met_cvt_rh_to_q(int, float *, int, float *, int, float *, float *, int)
Definition: met_cvt.c:99
double met_cvt_t_cvt(double, int, int)
Definition: met_cvt.c:284
int met_cvt_q_to_rh(int, float *, int, float *, int, float *, int, float *)
Definition: met_cvt.c:15