Main Page   Modules   File List   Globals  

Functions
BEAT-II Utility functions

Functions

void beatl2_c_array_to_fortran_array_uint8 (uint8_t *c_array, uint8_t *fortran_array, int ndims, const long dim[])
void beatl2_fortran_array_to_c_array_uint8 (uint8_t *fortran_array, uint8_t *c_array, int ndims, const long dim[])
void beatl2_c_array_to_fortran_array_int32 (int32_t *c_array, int32_t *fortran_array, int ndims, const long dim[])
void beatl2_fortran_array_to_c_array_int32 (int32_t *fortran_array, int32_t *c_array, int ndims, const long dim[])
void beatl2_c_array_to_fortran_array_double (double *c_array, double *fortran_array, int ndims, const long dim[])
void beatl2_fortran_array_to_c_array_double (double *fortran_array, double *c_array, int ndims, const long dim[])
int beatl2_hitran_code_to_molecule_name (int hitran_code, int html_flag, const char **name)
int beatl2_molecule_name_to_hitran_code (const char *name, int *hitran_code)
void beatl2_geographic_average (double latitude_p, double longitude_p, double latitude_q, double longitude_q, double *latitude_u, double *longitude_u)
void beatl2_geographic_intersection (double latitude_p1, double longitude_p1, double latitude_p2, double longitude_p2, double latitude_q1, double longitude_q1, double latitude_q2, double longitude_q2, double *latitude_u, double *longitude_u)
void beatl2_geographic_extrapolation (double latitude_p, double longitude_p, double latitude_q, double longitude_q, double *latitude_u, double *longitude_u)
void beatl2_geographic_rot90 (double latitude_p, double longitude_p, double latitude_q, double longitude_q, double *latitude_u, double *longitude_u)
double beatl2_geographic_surface_distance (double latitude_p, double longitude_p, double latitude_q, double longitude_q)

Detailed Description

The BEAT-II Utility module contains miscellaneous functions that are used within the BEAT-II implementation.

All functions inside this module are independent of the rest of the BEAT-II library. You can thus easily use these functions in your own source code by including beatl2-util.h and beatl2-util.c in your project.


Function Documentation

void beatl2_c_array_to_fortran_array_double ( double *  c_array,
double *  fortran_array,
int  ndims,
const long  dim[] 
)

Copy a multidimensional double data block with C array ordering to a data block with Fortran array ordering. Data that is stored inside a beatl2_Record field with multiple dimensions uses c array ordering, which means that the last dimension is the fastest running dimension. To convert this data to a data block that uses Fortran array ordering (in which the first dimension is the fastest running) one can either plainly copy the data and reverse the order of the dimensions or keep the order of the dimensions and reshuffle the data when copying. This function can be used for the second approach and will copy all double data from the c_array data block to the fortran_array block while reshuffling the order of the array elements.

Parameters:
c_arrayPointer to the source data block where the total amount of elements are stored in C array ordering.
fortran_arrayPointer to the destination data block where the total amount of elements will be copied to in Fortran array ordering.
ndimsNumber of dimensions for both the source and destination array (should be <= 8).
dimThe dimensions for both the source and destination array.
void beatl2_c_array_to_fortran_array_int32 ( int32_t *  c_array,
int32_t *  fortran_array,
int  ndims,
const long  dim[] 
)

Copy a multidimensional int32 data block with C array ordering to a data block with Fortran array ordering. Data that is stored inside a beatl2_Record field with multiple dimensions uses c array ordering, which means that the last dimension is the fastest running dimension. To convert this data to a data block that uses Fortran array ordering (in which the first dimension is the fastest running) one can either plainly copy the data and reverse the order of the dimensions or keep the order of the dimensions and reshuffle the data when copying. This function can be used for the second approach and will copy all int32_t data from the c_array data block to the fortran_array block while reshuffling the order of the array elements.

Parameters:
c_arrayPointer to the source data block where the total amount of elements are stored in C array ordering.
fortran_arrayPointer to the destination data block where the total amount of elements will be copied to in Fortran array ordering.
ndimsNumber of dimensions for both the source and destination array (should be <= 8).
dimThe dimensions for both the source and destination array.
void beatl2_c_array_to_fortran_array_uint8 ( uint8_t *  c_array,
uint8_t *  fortran_array,
int  ndims,
const long  dim[] 
)

Copy a multidimensional uint8 data block with C array ordering to a data block with Fortran array ordering. Data that is stored inside a beatl2_Record field with multiple dimensions uses c array ordering, which means that the last dimension is the fastest running dimension. To convert this data to a data block that uses Fortran array ordering (in which the first dimension is the fastest running) one can either plainly copy the data and reverse the order of the dimensions or keep the order of the dimensions and reshuffle the data when copying. This function can be used for the second approach and will copy all uint8 data from the c_array data block to the fortran_array block while reshuffling the order of the array elements.

Parameters:
c_arrayPointer to the source data block where the total amount of elements are stored in C array ordering.
fortran_arrayPointer to the destination data block where the total amount of elements will be copied to in Fortran array ordering.
ndimsNumber of dimensions for both the source and destination array (should be <= 8).
dimThe dimensions for both the source and destination array.
void beatl2_fortran_array_to_c_array_double ( double *  fortran_array,
double *  c_array,
int  ndims,
const long  dim[] 
)

Copy a multidimensional double data block with Fortran array ordering to a data block with C array ordering. Data that is stored inside a beatl2_Record field with multiple dimensions uses c array ordering, which means that the last dimension is the fastest running dimension. To convert data that uses Fortran array ordering (in which the first dimension is the fastest running) to this kind of data block one can either plainly copy the data and reverse the order of the dimensions or keep the order of the dimensions and reshuffle the data when copying. This function can be used for the second approach and will copy all double data from the fortran_array data block to the c_array block while reshuffling the order of the array elements.

Parameters:
fortran_arrayPointer to the source data block where the total amount of elements are stored in Fortran array ordering.
c_arrayPointer to the destination data block where the total amount of elements will be copied to in C array ordering.
ndimsNumber of dimensions for both the source and destination array (should be <= 8).
dimThe dimensions for both the source and destination array.
void beatl2_fortran_array_to_c_array_int32 ( int32_t *  fortran_array,
int32_t *  c_array,
int  ndims,
const long  dim[] 
)

Copy a multidimensional int32 data block with Fortran array ordering to a data block with C array ordering. Data that is stored inside a beatl2_Record field with multiple dimensions uses c array ordering, which means that the last dimension is the fastest running dimension. To convert data that uses Fortran array ordering (in which the first dimension is the fastest running) to this kind of data block one can either plainly copy the data and reverse the order of the dimensions or keep the order of the dimensions and reshuffle the data when copying. This function can be used for the second approach and will copy all int32 data from the fortran_array data block to the c_array block while reshuffling the order of the array elements.

Parameters:
fortran_arrayPointer to the source data block where the total amount of elements are stored in Fortran array ordering.
c_arrayPointer to the destination data block where the total amount of elements will be copied to in C array ordering.
ndimsNumber of dimensions for both the source and destination array (should be <= 8).
dimThe dimensions for both the source and destination array.
void beatl2_fortran_array_to_c_array_uint8 ( uint8_t *  fortran_array,
uint8_t *  c_array,
int  ndims,
const long  dim[] 
)

Copy a multidimensional uint8 data block with Fortran array ordering to a data block with C array ordering. Data that is stored inside a beatl2_Record field with multiple dimensions uses c array ordering, which means that the last dimension is the fastest running dimension. To convert data that uses Fortran array ordering (in which the first dimension is the fastest running) to this kind of data block one can either plainly copy the data and reverse the order of the dimensions or keep the order of the dimensions and reshuffle the data when copying. This function can be used for the second approach and will copy all uint8 data from the fortran_array data block to the c_array block while reshuffling the order of the array elements.

Parameters:
fortran_arrayPointer to the source data block where the total amount of elements are stored in Fortran array ordering.
c_arrayPointer to the destination data block where the total amount of elements will be copied to in C array ordering.
ndimsNumber of dimensions for both the source and destination array (should be <= 8).
dimThe dimensions for both the source and destination array.
void beatl2_geographic_average ( double  latitude_p,
double  longitude_p,
double  latitude_q,
double  longitude_q,
double *  latitude_u,
double *  longitude_u 
)

Calculate the point u on the greatcircle through p and q such that u is the average of p and q.

q / u / p

u = (p + q) / 2 if p and q are on opposite sides of the sphere an average of the latitudes and longitudes is taken.

void beatl2_geographic_extrapolation ( double  latitude_p,
double  longitude_p,
double  latitude_q,
double  longitude_q,
double *  latitude_u,
double *  longitude_u 
)

Calculate the point u on the greatcircle through p and q such that u is as far from p as p is from q.

u / p / q

u = 2(p.q)p - q, or in words: u is -q plus 2 times the projection of q on the vector p the projection of q on p is the inproduct of p and q in the direction of the unit vector p.

void beatl2_geographic_intersection ( double  latitude_p1,
double  longitude_p1,
double  latitude_p2,
double  longitude_p2,
double  latitude_q1,
double  longitude_q1,
double  latitude_q2,
double  longitude_q2,
double *  latitude_u,
double *  longitude_u 
)

Calculates the intersection point u of the greatcircles through p1/p2 and q1/q2 (given in longitude(phi)/latitude(tau) coordinates) where p1/p2/q1/q2 form a rectangular region

\ / q2 p2 \ / u / \ p1 q1 / \

The intersection point 'u' is calculated via: u = (p1 x p2) x (q1 x q2) (a cross product of cross products)

void beatl2_geographic_rot90 ( double  latitude_p,
double  longitude_p,
double  latitude_q,
double  longitude_q,
double *  latitude_u,
double *  longitude_u 
)

Calculate the point u that is a (counter-clockwise) rotation of p by 90 degrees around q.

u p \ / q

double beatl2_geographic_surface_distance ( double  latitude_p,
double  longitude_p,
double  latitude_q,
double  longitude_q 
)

Return the surface distance in km between points p and q

int beatl2_hitran_code_to_molecule_name ( int  hitran_code,
int  html_flag,
const char **  name 
)

Retrieve the HITRAN molecule name from an integer molecule identifier.

Parameters:
hitran_codeHITRAN integer molecule identifier of the molecule (1 - 39)
html_flagIf this flag is not equal to zero, a HTML-version of the molecule name will be returned; otherwise, the plain-ASCII name will be returned.
nameThis will receive a pointer to the name of the molecule.
Returns:
  • 0, Success
  • -1, Error in parameters.
int beatl2_molecule_name_to_hitran_code ( const char *  name,
int *  hitran_code 
)

Retrieve the HITRAN integer molecule identifier from a molecule name.

Parameters:
nameThe name of the molecule (any of the 39 molecule names defined by HITRAN; case-insensitive)
hitran_codeHITRAN integer molecule identifier of the molecule (1 - 39)
Returns:
  • 0, Success
  • -1, Error in parameters (incorrect molecule name).