RSL Internal Routines


RSL internal routines are routines used within the library and not meant for use in RSL application programs. Most of these routines are used only within the source code file that they exist, but a few are used in several different source code files.

The routines are listed by the RSL source code file in which they can be found.

As of version 0.39, the source code for the wsr88d (v1.14), lassen (v1.1), nsig (v1.3), tg (v1.1), and mcgill (v1.1) libraries are included in RSL. This precludes the need to specify a long list of additional libraries during the link step when building application. Also, it simplifies the RSL installation procedure. Still needed are two routines: ppmtogif and ppmtopict, from the pbmplus package.


New in v0.41

gzip.c

int no_command(char *cmd);
FILE *uncompress_pipe(FILE *fp);
FILE *compress_pipe(FILE *fp);

column.c

Column *compute_column_products(Column *c);
Compute the vertical structure values within the Column passed in the parameter list using the data values stored in the Column. Vertical_structure values computed are zmax,hzmax and the eth array (echo tops). The dBz, slant range and height values must exist within the Column before this routine is called. The array for echo top values must be allocated as well.

Column *get_column_dbz(Volume *v,Column *c,float azim);
Retrieve the dBz values from the Volume v using the nearest neighbor technique along a straight vertical line. The vertical line is positioned at the azimuth passed in the parameter list and the ground range that should already exist in Column c. The slant range array, height array and memory allocation for the dBz array should already exist as well.

Column *get_column_range_coord(Volume *v,Column *c, float grange);
Using the elevation angles from Volume v and the ground range (grange), calculate the slant ranges and heights for all points at the intersections of the Sweeps in Volume v and a straight vertical line at the ground range value grange.

Column *new_column(int nsteps,float ett_start,float ett_int,int num_ett);
Allocate space for a Column data structure and arrays within the Column. The value nsteps is the length of the dbz,height and slant range arrays. The lenght of the echo top array, and thus the number of thresholds, is num_ett. The first echo top threshold is ett_start followed by additional thresholds every ett_int.

void copy_column_range_coord(Column *from,Column *to);
Copy the range dependent coordinates from Column from to Column to. Range dependent variables in the Column data structure are ground_range, the h array (height) and slant_range array. No memory space is allocated for the Column to.


endian.c

int big_endian(void);
int little_endian(void);
void swap_4_bytes(void *word);
void swap_2_bytes(void *word);

image_gen.c

None.

interp.c

double dir_angle_diff(float x,float y); Returns signed difference between angles x and y. Returns a positive value if y > x and a negative value if y double from_dB(double db); Convert a decibel scale value to a linear scale value.

double get_linear_value_from_sweep(Sweep *sweep,float srange,float azim,float limit); Return an interpolate value between two rays within a sweep. Interpolation is done along the azimuth coordinate. No interpolation is done in the range direction. The routine expects to work with values that are in a decibel scale (reflectivity data), but it returns values in linear scale.

double to_dB(double value); Convert a linear scale value to a decibel scale value.

float get_dist(float r1,float a1,float e1,float r2,float a2,float e2); Compute the distence between two points in space given their spherical coordinates. r1 (range),a1 (azimuth angle) and e1 (elevation angle) are the coordinates for the first point. Angles are measured in degrees.

void get_surrounding_ray(Ray **ccwise,Ray **cwise,Sweep *s,float ray_angle); Return the two rays within a sweep that surround the angle ray_angle. The ray that is counter-clockwise to ray_angle is returned in ccwise. The ray that is clockwise to ray_angle is returned in cwise. **ccise and **cwise are pointers to ray pointers. For example, if r is of type *Ray, then &r should be passed for either **ccwise or **cwise.

void get_surrounding_sweep(Sweep **below,Sweep **above, Volume *v,float elev); Return the sweeps that are above and below the elevation angle elev. **below and **above are pointers to Sweep pointers. if s is of type *Sweep, pass &s as either **above or **below. If the conditionexist where a sweep does not exist for either the above or below case, then a the appropriate pointer is set to NULL.

void get_xyz_coord(double *x,double *y,double *z,double range,double azim,double elev); Convert a set of spherical coordinates to a set of cartesian coordinates.


lassen_to_radar.c

void lassen_load_sweep(Sweep *s, int isweep_num, unsigned int mask, int early, s truct sweep_index *ptr);

mcgill.c

mcgFile_t *mcgFileOpen(int *code, char *filename);
int mcgFileClose(mcgFile_t *file);
int mcgRecordRead(mcgRecord_t *record, mcgFile_t *file);
mcgSegmentID mcgSegmentKeyIdentify(int key);
int mcgRayBuild(mcgRay_t *ray, mcgFile_t *file);

mcgill_to_radar.c

void RayFill(Ray *rsl_ray, mcgRay_t *mcg_ray);
void Ray_headerInit(Ray *ray, mcgHeader_t *head, mcgRay_t *mcg_ray, int ray_num, int num_bins_rsl);
void Sweep_headerInit(Sweep *sweep, mcgRay_t *mcg_ray, int nrays);
void Volume_headerInit(Volume *volume, short vol_scan_format);
void Radar_headerInit(Radar *radar, mcgHeader_t *mcg_head);

nsig_to_radar.c

Radar * nsig_to_radar_headers_only(char * filename);
Radar * n2r(char * filename, int data_flag, int misc_flag);
int Rset_header(Radar * Radptr, nsig_file * nsfile);
int Vset_header( Volume * volptr, int n, char * string);
int Swset_header( Sweep * sweepptr, int sweepnum, float elev, float beam_width, int nrays);
int set_mask(int k, int * array);
void sec2dhms(long sec, int * d, int * h, int * m, int *s);
int rtype2ntype( int j );
int ntype2rtype( int j );
char * get_type_string(int j);
int Rayset_header(Ray * rayptr, nsig_ray_data * ray_data_ptr, nsig_ingest_data_header * idhdptr, Fixed_Header * fhptr);
void Set_FixedHeader(Fixed_Header * FHptr, nsig_file * nsfile);

print_histogram_catelog.c

void print_histogram_catalog(Histogram *histogram, int min_range, int max_range, char *da te, char *filename);

radar.c

void print_vect(float v[], int istart, int istop);
void radar_load_date_time(Radar *radar);


radar_to_uf.c

none.

range.c

none.

ray_indexes.c

static void set_high_and_low_pointers(Sweep *s);
static Azimuth_hash *hash_add_node(Azimuth_hash *node, Ray *ray);

read_write.c

Radar *set_default_function_pointers(Radar *radar);

sort_rays.c

static int ray_sort_compare(Ray **r1, Ray **r2);
static int ray_sort_compare_by_time(Ray **r1, Ray **r2);
static int sweep_sort_compare(Sweep **s1, Sweep **s2);

toga_to_radar.c

void fill_ray(Ray *ray, tg_file_str *tg_file, int datatype);
void fill_ray_header(Ray *ray, tg_file_str *tg_file, int elev_num, int datatype);
void fill_sweep_header(Radar *radar, tg_map_head_str *map_head, int sweep_num, int nrays);
void fill_volume_header(Radar *radar, tg_map_head_str *map_head);
void fill_radar_header(Radar *radar, tg_map_head_str *map_head);

uf_to_radar.c

Volume *reset_nsweeps_in_volume(Volume *volume);
Radar *reset_nsweeps_in_all_volumes(Radar *radar);
Volume *copy_sweeps_into_volume(Volume *new_volume, Volume *old_volume);
void uf_into_radar(UF_buffer uf, Radar **the_radar);
void swap_uf_buffer(UF_buffer uf);
static enum UF_type type_of_uf_file(char *infile);

volume.c

Azimuth_hash *the_closest_hash(Azimuth_hash *hash, float ray_angle);
Return the hash pointer that contains the closest Ray to the angle ray_angle. The hash passed to this routine can be any hash within the a Sweep's hashing table, but for the quickest search it should be the hash pointer with the index returned by the internal routine hash_bin.

double angle_diff(float x, float y);
Return the absolute value of the difference between angle x and angle y. Angles are measure in degrees and the return value has a range from 0 to 180.

double ccwise_angle_diff(float x,float y);
Returns the counter-clockwise angle difference of x to y. Values returned will always be positive and exist in the range from 0 to 360. Examples: if x = 345 and y = 355 the value returned will be 350. On the other hand if x = 345 and y = 335 then the value returned will be 10.

double cwise_angle_diff(float x,float y);
Returns the clockwise angle difference of x to y. Values returned will always be positive and exist in the range from 0 to 360.

int get_closest_sweep_index(Volume *v,float sweep_angle);
int hash_bin(Sweep *s,float angle);

wsr88d_to_radar.c

void float_to_range(float *x, Range *c, int n, Range (*function)(float x) );
int wsr88d_load_sweep_into_volume(Wsr88d_sweep ws, Volume *v, int nsweep, unsigned int vmask);

WSR88D library (v1.14)

wsr88d.c
wsr88d.h
wsr88d_get_site.c
wsr88d_locations.dat

Lassen library (v1.1)

accessvolhead.c
cvrt.h
freevol.c
lassen.h
portable.h
radar.h
radinfo.h
raw.h
read_head.c
readvol.c
sunrise_head.h
sunrise_time.h
xdr.h

NSIG library (v1.3)

nsig.c
nsig.h

TG library (v1.1)

toga.c
toga.h

McGill library (v1.1)

mcgill.c
mcgill.h