*.bz2
+*.exe
*.gz
*.la
*.lo
*.o
+*.swp
*~
.deps/
.libs/
libtool
local
ltmain.sh
+m4/
missing
-rapic-lex.c
-rapic.c
-rapic.h
+src/rapic_parse.c
+src/rapic_parse.h
+src/rapic_scan.c
stamp-h1
tags
valgrind.out
-## Process w/ automake. Or, autoreconf; make ##
-AUTOMAKE_OPTIONS = foreign
-SUBDIRS = . colors doc examples
-INCLUDES = -I. -I$(srcdir) -I$(prefix)/include -I$(prefix)/toolkit/include
+SUBDIRS = src examples data doc
-includedir = $(prefix)/include
-colordir = $(libdir)/colors
+ACLOCAL_AMFLAGS = -I m4
-lib_LTLIBRARIES = librsl.la
-
-librsl_la_LDFLAGS = -version-info 1:41
-librsl_la_SOURCES = \
-$(rapic_c) $(radtec_c)\
-dorade.c dorade_print.c dorade_to_radar.c\
-lassen.c lassen_to_radar.c \
-edge_to_radar.c \
- radar.c volume.c image_gen.c cappi.c fraction.c read_write.c farea.c \
- range.c radar_to_uf.c uf_to_radar.c wsr88d_to_radar.c \
- carpi.c cube.c sort_rays.c toga_to_radar.c gts.c histogram.c \
- ray_indexes.c anyformat_to_radar.c get_win.c endian.c mcgill_to_radar.c \
- mcgill.c interp.c toga.c wsr88d.c wsr88d_get_site.c wsr88d_m31.c \
- gzip.c prune.c reverse.c fix_headers.c \
- nsig_to_radar.c nsig.c nsig2_to_radar.c \
- africa_to_radar.c africa.c \
- radar_to_hdf_2.c hdf_to_radar.c toolkit_memory_mgt.c \
- radar_to_hdf_1.c rainbow.c rainbow_to_radar.c $(headers)
-
-librsl_la_DEPENDENCIES = $(build_headers)
-
-build_headers = rsl.h wsr88d.h toolkit_1BC-51_appl.h
-
-headers = africa.h dorade.h lassen.h \
- mcgill.h nsig.h radtec.h rainbow.h \
- rapic_routines.h toga.h \
- $(build_headers)
-
-rapic_c = rapic_to_radar.c rapic.y rapic-lex.l rapic_routines.c
-radtec_c = radtec_to_radar.c radtec.c
-
-
-rsl.h: Makefile
- @for h in $(build_headers); do \
- echo -n "Checking substitutions in header file $$h ... "; \
- cp $$h $$h.in; \
- sed -e 's/RSL_VERSION_STR.*/RSL_VERSION_STR \"$(VERSION)\"/' \
- -e 's|#define COLORDIR.*|#define COLORDIR \"$(colordir)\"|' \
- -e 's|#define WSR88D_SITE_INFO_FILE.*|#define WSR88D_SITE_INFO_FILE \"$(libdir)/wsr88d_locations.dat\"|' \
- < $$h.in > $$h.new; \
- if cmp -s $$h $$h.new; then \
- rm $$h.new; \
- echo "$$h remains untouched."; \
- else \
- mv $$h.new $$h; \
- echo "substitutions made in $$h."; \
- fi; \
- rm -f $$h.in; \
- done
-
-PREFIX = rapic
-LFLAGS = -P$(PREFIX)
-YFLAGS = -d -p $(PREFIX)
-LEX_OUTPUT_ROOT = lex.$(PREFIX)
-
-
-install-exec-hook:
- $(INSTALL) -d $(includedir)
- $(INSTALL) -m 644 rsl.h $(includedir)
- $(INSTALL) -m 644 toolkit_1BC-51_appl.h $(includedir)
- $(INSTALL) -m 644 wsr88d_locations.dat $(libdir)
-
-EXTRA_DIST = CHANGES Copyright GPL LGPL wsr88d_locations.dat rapic.h
-
-DISTCLEANFILES = rapic.c rapic-lex.c
+EXTRA_DIST = CHANGES Copyright GPL LGPL
--- /dev/null
+#!/bin/sh
+
+libtoolize
+aclocal
+autoheader
+automake -f -a -c
+autoconf
+
+# Run configure
+./configure "$@"
+++ /dev/null
-AUTOMAKE_OPTIONS = foreign
-
-colordir = $(prefix)/lib/colors
-color_DATA = *.???
-
-EXTRA_DIST = $(color_DATA)
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(rsl, v1.41)
-AC_CONFIG_SRCDIR(volume.c)
+# Process this file with autoconf to produce a configure script.
+AC_INIT(rsl, 1.41)
+AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability foreign])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
+AC_CONFIG_MACRO_DIR([m4])
-dnl Default for GVS and friends.
-AC_PREFIX_DEFAULT(/usr/local/trmm/GVBOX)
-
-dnl Checks for programs.
+# Checks for programs.
AC_PROG_CC
AM_PROG_LIBTOOL
-AC_PROG_YACC
AM_PROG_LEX
+AC_PROG_YACC
AC_PROG_LN_S
-AC_PROG_RANLIB
-dnl Checks for header files.
+# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h malloc.h strings.h unistd.h)
-dnl Checks for typedefs, structures, and compiler characteristics.
+# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM
-dnl Checks for library functions.
-dnl AC_FUNC_SETVBUF_REVERSED
+# Checks for library functions.
+# AC_FUNC_SETVBUF_REVERSED
AC_CHECK_FUNCS(mktime strdup strstr)
-dnl I would like lassen to be defined. Override this in config.h.
+# I would like lassen to be defined. Override this in config.h.
AC_DEFINE(HAVE_LASSEN, 1,
[For LASSEN capability. Change this to '#undef HAVE_LASSEN', if you
- don't want LASSEN.])
+ dont want LASSEN.])
-dnl Checks for libraries.
+# Checks for libraries.
if test $prefix = NONE; then
prefix=$ac_default_prefix
fi
# Because -letor may depend on RSL being installed, just check for
# the library libetor.a in a couple of places.
-dnl For autoheader, generate template for HAVE_LIBETOR.
+# For autoheader, generate template for HAVE_LIBETOR.
AH_TEMPLATE(HAVE_LIBETOR,[For EDGE capability. Change this
to '#define HAVE_LIBETOR 1', if you have libetor -- the EDGE decoding
library.])
fi
AC_MSG_RESULT(LIBS = $LIBS)
-AC_CONFIG_FILES([Makefile colors/Makefile doc/Makefile examples/Makefile])
+AC_CONFIG_FILES([Makefile doc/Makefile data/Makefile examples/Makefile src/Makefile])
AC_OUTPUT
--- /dev/null
+colordir = $(datadir)/rsl/colors
+dist_color_DATA = colors/*.clr
+
+wsr88ddir = $(datadir)/rsl/
+dist_wsr88d_DATA = wsr88d_locations.dat
93235 KDAX SACRAMENTO CA 38 30 4 -121 40 40 9
13985 KDDC DODGE_CITY KS 37 45 39 -99 58 7 789
22015 KDFX LAUGHLIN_AFB TX 29 16 22 -100 16 50 345
+33771 KDGX JACKSON MS 32 16 33 -89 58 48 151
93771 KDIX PHILADELPHIA PA 39 56 49 -74 24 39 45
14913 KDLH DULUTH MN 46 50 13 -92 12 35 435
94984 KDMX DES_MOINES IA 41 43 53 -93 43 22 299
53839 KHPX FORT_CAMPBELL KY 36 44 12 -87 17 6 176
53857 KHTX HUNTSVILLE AL 34 55 50 -86 05 00 537
3928 KICT WICHITA KS 37 39 17 -97 26 34 407
+53118 KICX CEDAR_CITY UT 37 35 9 -112 51 21 3231
13841 KILN CINCINNATI OH 39 25 13 -83 49 18 322
4833 KILX LINCOLN IL 40 9 2 -89 20 13 177
93819 KIND INDIANAPOLIS IN 39 42 27 -86 16 49 241
3984 KINX TULSA OK 36 10 30 -95 33 53 204
23104 KIWA PHOENIX AZ 33 17 21 -111 40 12 412
+4844 KIWX N_INDIANA IN 41 21 0 -85 42 0 293
3940 KJAN JACKSON MS 32 19 4 -90 4 48 91
13889 KJAX JACKSONVILLE FL 30 29 5 -81 42 7 10
53824 KJGX ROBINS_AFB GA 32 40 30 -83 21 4 159
13957 KSHV SHREVEPORT LA 32 27 3 -93 50 29 83
23034 KSJT SAN_ANGELO TX 31 22 17 -100 29 33 576
53117 KSOX SANTA_ANA_MT CA 33 49 4 -117 38 9 923
+53906 KSRX W_ARKANSAS AR 35 16 48 -94 21 0 195
92801 KTBW TAMPA FL 27 42 20 -82 24 6 12
4102 KTFX GREAT_FALLS MT 47 27 35 -111 23 7 1132
93805 KTLH TALLAHASSEE FL 30 23 51 -84 19 44 19
3979 KTLX OKLAHOMA_CITY OK 35 19 59 -97 16 40 370
3986 KTWX TOPEKA KS 38 59 49 -96 13 57 417
+54776 KTYX MONTAGUE NY 43 45 3 -75 40 30 563
94047 KUDX RAPID_CITY SD 44 7 30 -102 49 47 919
94981 KUEX HASTINGS NE 40 19 15 -98 26 31 602
53856 KVAX MOODY_AFB GA 30 53 25 -83 0 6 54
94234 KVBX VANDENBRG_AFB CA 34 50 17 -120 23 45 376
3995 KVNX VANCE_AFB OK 36 44 27 -98 7 40 369
53101 KVTX LOS_ANGELES CA 34 24 42 -119 10 47 831
+0 KVWX EVANSVILLE IN 38 16 12 -87 43 12 190
53116 KYUX YUMA AZ 32 29 43 -114 39 24 53
26548 PAHG ANCHORAGE AK 60 43 33 -151 21 5 74
25404 PAIH MIDDLETON_IS AK 59 27 41 -146 18 11 20
24690 PAPD FAIRBANKS AK 65 2 6 -147 30 6 790
41417 PGUA ANDERSEN_AFB GU 13 27 16 144 48 30 80
22548 PHKI SOUTH_KAUAI HI 21 53 39 -159 33 8 55
-43216 RKSG CMP_HUMPHRYS KOR 36 57 21 127 1 16 16
-42219 RODN KADENA OKI 26 18 7 127 54 35 66
-33771 KDGX JACKSON MS 32 16 33 -89 58 48 151
-53118 KICX CEDAR_CITY UT 37 35 9 -112 51 21 3231
-4844 KIWX N_INDIANA IN 41 21 0 -85 42 0 293
-53906 KSRX W_ARKANSAS AR 35 16 48 -94 21 0 195
-54776 KTYX MONTAGUE NY 43 45 3 -75 40 30 563
-0 KVWX EVANSVILLE IN 38 16 12 -87 43 12 190
0 PHKM KOHALA HI 20 7 12 -155 46 12 1162
0 PHMO MOLOKAI HI 21 7 12 -157 10 12 415
0 PHWA HAWAII HI 19 4 48 -155 34 12 421
+43216 RKSG CMP_HUMPHRYS KOR 36 57 21 127 1 16 16
+42219 RODN KADENA OKI 26 18 7 127 54 35 66
0 TJUA SAN_JUAN PR 18 7 12 -66 4 48 931
AUTOMAKE_OPTIONS = foreign
-docdir = $(prefix)/doc/$(PACKAGE)
-doc_DATA = *.html *.gif *.jpg
-
-EXTRA_DIST = $(doc_DATA) *.fig
-
-install-exec-hook:
- -mkdir $(prefix)/doc
- -mkdir $(docdir)
- $(INSTALL) -m 444 ../README $(docdir)
- $(INSTALL) -m 444 ../CHANGES $(docdir)
+dist_doc_DATA = *.html *.gif *.jpg *.fig ../README ../CHANGES
-## Use automake to generate Makefile.in from this file ##
+LIBS = $(top_srcdir)/src/librsl.la
+AM_CFLAGS = -I$(top_srcdir)/src
-AUTOMAKE_OPTIONS = foreign
-
-INCLUDES = -I$(prefix)/include
-LOCAL_LIB = ../.libs/librsl.a
-LDADD = @LIBS@ $(LOCAL_LIB)
bin_PROGRAMS = any_to_gif any_to_uf qlook
-any_to_gif_LDFLAGS = -static
-any_to_uf_LDFLAGS = -static
+
# Additional program to build but not install
noinst_PROGRAMS = any_to_ppm any_to_ufgz bscan \
- cappi_image dorade_main killer_sweep \
- kwaj_subtract_one_day lassen_to_gif print_hash_table \
- print_header_info sector test_get_win \
- wsr88d_to_gif wsr_hist_uf_test
-
-
-# Only this one has more than one source. All the others use the
-# default *.c format.
+ cappi_image dorade_main killer_sweep \
+ kwaj_subtract_one_day lassen_to_gif print_hash_table \
+ print_header_info sector test_get_win \
+ wsr88d_to_gif wsr_hist_uf_test
+# qlook has multiple sources, the otherss use the default *.c format
qlook_SOURCES = qlook.c qlook_usage.c adjust_gate_size.c
EXTRA_DIST = run_tests
fprintf(stderr, " -b x = Make black for dbz below x. Default = 0 (no action).\n");
exit(-1);
}
-process_args(int argc, char **argv,
+void process_args(int argc, char **argv,
char **in_file, char **callid, int *verbose, int *wholevolume,
int *xdim, float *range, int *dbz_black)
{
exit(-1);
}
-process_args(int argc, char **argv,
+void process_args(int argc, char **argv,
char **in_file, char **out_file, char **first_file)
{
int c;
}
-main (int argc, char **argv)
+int main (int argc, char **argv)
{
Radar *radar;
RSL_radar_verbose_on();
radar = RSL_anyformat_to_radar(infile, first_file);
RSL_radar_to_uf(radar, outfile);
-
+ return 0;
}
exit(-1);
}
-process_args(int argc, char **argv,
+void process_args(int argc, char **argv,
char **in_file, char **out_file, char **first_file)
{
int c;
}
-main (int argc, char **argv)
+int main (int argc, char **argv)
{
Radar *radar;
radar = RSL_anyformat_to_radar(infile, first_file);
RSL_radar_to_uf_gzip(radar, outfile);
-
+ return 0;
}
#include "rsl.h"
-usage()
+void usage()
{
fprintf(stderr,"Usage: bscan infile [callid]\n");
exit(-1);
}
-process_args(int argc, char **argv,
+void process_args(int argc, char **argv,
char **in_file, char **callid)
{
}
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *infile, *callid;
Radar *radar;
- Volume *cappi_vol;
char *index_str[] = {"DZ", "VR", "SW"};
int i;
RSL_bscan_volume((Volume *) radar->v[i], "bscan.ppm");
printf("----> BSCAN complete.\n");
- exit(0);
-
+ return 0;
}
#include <string.h>
#include "rsl.h"
-usage(int argc, char **argv)
+void usage(int argc, char **argv)
{
fprintf(stderr,"Usage: %s infile [firstfile | callid]\n", argv[0]);
exit(-1);
}
-process_args(int argc, char **argv,
+void process_args(int argc, char **argv,
char **in_file, char **out_file)
{
}
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *infile, *firstfile;
char outfile[100];
RSL_free_cappi(cappi);
}
-
- exit(0);
-
+ return 0;
}
Azimuth_hash *index;
float azim;
float res;
+ int SWEEP_INDEX(Sweep *s); // From Volume.c
if (s == NULL) return;
sweep_index = SWEEP_INDEX(s);
/* */
/**********************************************************************/
#include<time.h>
-void *subtract_one_day(int month, int day, int year,
- int *m, int *d, int *y)
+void subtract_one_day(int month, int day, int year,
+ int *m, int *d, int *y)
{
/* Connocialize and subtract. */
struct tm *t;
*m = t->tm_mon+1;
*d = t->tm_mday;
*y = t->tm_year+1900;
- return;
}
/**********************************************************************/
Azimuth_hash *index;
float azim;
float res;
+ int SWEEP_INDEX(Sweep *s); // From Volume.c
if (s == NULL) return;
sweep_index = SWEEP_INDEX(s);
int qprint_ray;
-usage(char **argv)
+void usage(char **argv)
{
fprintf(stderr,"Usage: %s [-v] [-f nexrad_id] [infile]\n", argv[0]);
exit(-1);
}
-process_args(int argc, char **argv,
+void process_args(int argc, char **argv,
char **in_file, int *qprint_ray,
char **site)
{
}
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *infile;
print_header_for_volume(radar->v[i]);
}
}
-exit(0);
+return 0;
}
/***********************************************************************/
/*** DBW ***************************************************************/
/***********************************************************************/
-main(int argc, char **argv) {
+int main(int argc, char **argv) {
Radar *radar;
Volume *dz_volume, *vr_volume;
Volume *dr_volume, *zt_volume;
- Volume *sw_volume, *qc_volume, *volume;
+ Volume *sw_volume, *qc_volume;
Sweep *sweep;
- Sweep *dz_sweep, *qc_sweep;
- Sweep *dr_sweep, *zt_sweep;
- Sweep *vr_sweep, *sw_sweep;
Ray *ray;
- int reflectivity, qc_reflectivity, nvolumes;
+ int reflectivity, qc_reflectivity;
int differential_reflectivity, total_reflectivity;
int velocity, spectral_width;
int make_catalog, make_gif, make_pgm;
int make_uf, make_bscan;
int xdim, ydim, num_sweeps;
- int i,j,k,l,n, verbose, kk;
- int month, day, year, hour, min;
+ int i,j, verbose;
int ncbins, width;
int print_azim;
float scale, dbz_offset;
float latitude, longitude;
- float sec;
float maxr;
- float nyquist, max_range, gate_size_adjustment;
+ float max_range, gate_size_adjustment;
char tape_id[100];
char in_file[100], site_id[100];
- char filename[100], outfile[100], nexfile[100];
- char command[100], file_prefix[100], file_suffix[3];
- char dir_string[100], red[120], grn[120], blu[120];
- char time_string[14], site_string[10],img_base[20];
+ char filename[100];
+ char file_suffix[10];
+ char time_string[14];
char pathname[256], gifdir[100], pgmdir[100], ufdir[100];
char *inpath;
- FILE *fp;
/* Set default values */
if(verbose)
printf("Finished!\n");
- exit (0);
+ return 0;
} /* End of main */
Azimuth_hash *index;
float azim;
float res;
+ int SWEEP_INDEX(Sweep *s); // From Volume.c
if (s == NULL) return;
sweep_index = SWEEP_INDEX(s);
{
int i, j;
Sweep *new_sweep;
- Ray *saved_ray;
if (s == NULL) return NULL;
}
-main (int argc, char **argv)
+int main (int argc, char **argv)
{
Radar *new_radar, *tmp_radar, *radar;
}
RSL_free_radar(radar);
printf("done\n");
- exit (0);
+ return 0;
}
#include "rsl.h"
-usage()
+void usage()
{
fprintf(stderr,"Usage: wsr_hist_uf_test infile [-s site_id]\n");
exit(-1);
}
-process_args(int argc, char **argv, char **in_file, char **site)
+void process_args(int argc, char **argv, char **in_file, char **site)
{
int c;
}
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *infile;
char *site = NULL;
histogram, -30, 70, 0, 200);
RSL_print_histogram(histogram, 0, 200, "hist_uf_to_radar.dat");
- exit(0);
-
+ return 0;
}
--- /dev/null
+#!/bin/bash
+./autogen.sh \
+ --enable-shared \
+ --disable-static \
+ --host=i686-pc-mingw32 \
+ --prefix=/ \
+ CFLAGS="-g -Wall -Wno-unused -O3"
--- /dev/null
+#!/bin/bash
+./autogen.sh \
+ --enable-shared \
+ --disable-static \
+ CFLAGS="-g -Wall -O3"
+++ /dev/null
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Public domain
-
-# $Id: mkinstalldirs,v 1.1 1999/12/06 05:21:06 merritt Exp $
-
-errstatus=0
-
-for file
-do
- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
- shift
-
- pathcomp=
- for d
- do
- pathcomp="$pathcomp$d"
- case "$pathcomp" in
- -* ) pathcomp=./$pathcomp ;;
- esac
-
- if test ! -d "$pathcomp"; then
- echo "mkdir $pathcomp"
-
- mkdir "$pathcomp" || lasterr=$?
-
- if test ! -d "$pathcomp"; then
- errstatus=$lasterr
- fi
- fi
-
- pathcomp="$pathcomp/"
- done
-done
-
-exit $errstatus
-
-# mkinstalldirs ends here
--- /dev/null
+AM_CPPFLAGS = -I. -I..
+AM_YFLAGS = -d
+
+lib_LTLIBRARIES = librsl.la
+
+include_HEADERS = rsl.h toolkit_1BC-51_appl.h
+
+headers = africa.h dorade.h lassen.h \
+ mcgill.h nsig.h radtec.h rainbow.h \
+ rapic_routines.h toga.h \
+ wsr88d.h \
+ $(include_HEADERS)
+
+librsl_la_LDFLAGS = -version-info 1:41
+librsl_la_CPPFLAGS = -DDATADIR="\"$(datadir)/rsl\""
+librsl_la_SOURCES = \
+ rapic_parse.y rapic_scan.l rapic_to_radar.c rapic_routines.c \
+ radtec.c radtec_to_radar.c \
+ dorade.c dorade_print.c dorade_to_radar.c \
+ lassen.c lassen_to_radar.c \
+ edge_to_radar.c \
+ radar.c volume.c image_gen.c cappi.c fraction.c read_write.c farea.c \
+ range.c radar_to_uf.c uf_to_radar.c wsr88d_to_radar.c \
+ carpi.c cube.c sort_rays.c toga_to_radar.c gts.c histogram.c \
+ ray_indexes.c anyformat_to_radar.c get_win.c endian.c mcgill_to_radar.c \
+ mcgill.c interp.c toga.c wsr88d.c wsr88d_get_site.c wsr88d_m31.c \
+ gzip.c prune.c reverse.c fix_headers.c \
+ nsig_to_radar.c nsig.c nsig2_to_radar.c \
+ africa_to_radar.c africa.c \
+ radar_to_hdf_2.c hdf_to_radar.c toolkit_memory_mgt.c \
+ radar_to_hdf_1.c rainbow.c rainbow_to_radar.c $(headers)
+
+# This should be speciifc to rapic,
+# but I'm not sure how to do that with autofoo
+AM_LFLAGS = -P rapic
+AM_YFLAGS += -p rapic
+LEX_OUTPUT_ROOT = lex.rapic
+
+BUILT_SOURCES = rapic_parse.h
+
+DISTCLEANFILES = rapic_scan.c rapic_parse.c
perror("dorade_read_comment_block");
return NULL;
}
- fread(cb->code, sizeof(cb->code), 1, in);
- fread(&cb->len, sizeof(cb->len), 1, in);
+ if (fread(cb->code, sizeof(cb->code), 1, in) != 1) {
+ perror("dorade_read_comment_block: fread");
+ return NULL;
+ }
+ if (fread(&cb->len, sizeof(cb->len), 1, in) != 1) {
+ perror("dorade_read_comment_block: fread");
+ return NULL;
+ }
/* Check for big endian data on little endian platform. The smallest value
* cb->len could have is 8 (length of cb->code + cb->len), so we put that in
perror("dorade_read_comment_block: cb->comment");
return cb;
}
- fread(cb->comment, sizeof(char), cb->len-8, in);
+ if (fread(cb->comment, sizeof(char), cb->len-8, in) != cb->len){
+ perror("dorade_read_comment_block: fread");
+ return NULL;
+ }
return cb;
}
return NULL;
}
- fread(vd, sizeof(Volume_desc), 1, in);
+ if (fread(vd, sizeof(Volume_desc), 1, in) != 1) {
+ perror("dorade_read_volume_desc: fread");
+ return NULL;
+ }
+
/* Now, convert from Big Endian. */
if (do_swap) {
vd->len = ntohl(vd->len);
return NULL;
}
- fread(rd, sizeof(Radar_desc), 1, in);
+ if (fread(rd, sizeof(Radar_desc), 1, in) != 1) {
+ perror("dorade_read_radar_desc: fread");
+ return NULL;
+ }
/* Now, convert from Big Endian. */
if (do_swap) {
swap_4_bytes(&rd->len);
return NULL;
}
- fread(pd, sizeof(Parameter_desc), 1, in);
+ if (fread(pd, sizeof(Parameter_desc), 1, in) != 1) {
+ perror("dorade_read_parameter_desc: fread");
+ return NULL;
+ }
/* Now, convert from Big Endian. */
if (do_swap) {
swap_4_bytes(&pd->len);
return NULL;
}
- fread(&cv->code, sizeof(cv->code), 1, in);
- fread(&cv->len, sizeof(cv->len), 1, in);
- fread(&cv->ncells, sizeof(cv->ncells), 1, in);
+ if (fread(&cv->code, sizeof(cv->code), 1, in) != 1 ||
+ fread(&cv->len, sizeof(cv->len), 1, in) != 1 ||
+ fread(&cv->ncells, sizeof(cv->ncells), 1, in) != 1) {
+ perror("dorade_read_cell_range_vector: fread");
+ return NULL;
+ }
if (do_swap) {
swap_4_bytes(&cv->len);
swap_4_bytes(&cv->ncells);
perror("dorade_read_cell_range_vector: cv->range_cell");
return cv;
}
- fread(cv->range_cell, sizeof(float), cv->ncells, in);
+ if (fread(cv->range_cell, sizeof(float), cv->ncells, in) != cv->ncells) {
+ perror("dorade_read_cell_range_vector: fread");
+ return NULL;
+ }
if (do_swap) {
for (i=0; i<cv->ncells; i++)
- cv->ncells*4;
buff = (char *)malloc(i);
if (!buff) return cv;
- fread(buff, sizeof(char), i, in);
+ if (fread(buff, sizeof(char), i, in) != i) {
+ perror("dorade_read_cell_range_vector: fread");
+ return NULL;
+ }
free(buff);
return cv;
}
/* Make sure we have Correction Factor Descriptor. */
while (!is_cfac) {
- fread(cf->code, sizeof(cf->code), 1, in);
+ if (fread(cf->code, sizeof(cf->code), 1, in) != 1) {
+ perror("dorade_read_correction_factor_desc: fread");
+ return NULL;
+ }
if (strncmp(cf->code, "CFAC", 4) == 0)
is_cfac = 1;
else {
- fread(&cf->len, sizeof(cf->len), 1, in);
+ if (fread(&cf->len, sizeof(cf->len), 1, in) != 1) {
+ perror("dorade_read_correction_factor_desc: fread");
+ return NULL;
+ }
if (do_swap) swap_4_bytes(&cf->len);
remaining = (char *) malloc(cf->len-8);
if (!remaining) {
fprintf(stderr,"cf->len = %d\n\n", cf->len);
return NULL;
}
- fread(remaining, sizeof(char), cf->len-8, in);
+ if (fread(remaining, sizeof(char), cf->len-8, in) != 1) {
+ perror("dorade_read_correction_factor_desc: fread");
+ return NULL;
+ }
free(remaining);
}
}
- fread(&cf->len, sizeof(Correction_factor_desc)-4, 1, in);
+ if (fread(&cf->len, sizeof(Correction_factor_desc)-4, 1, in) != 1) {
+ perror("dorade_read_correction_factor_desc: fread");
+ return NULL;
+ }
/* Now, convert from Big Endian. */
if (do_swap) {
swap_4_bytes(&cf->len);
return NULL;
}
- fread(si, sizeof(Sweep_info), 1, in);
+ if (fread(si, sizeof(Sweep_info), 1, in) != 1) {
+ perror("dorade_read_sweep_info: fread");
+ return NULL;
+ }
/* FIXME: ?? For now, VOLD is what we expect when there
* are no more SWIB. This is a data driven EOF.
* Returning NULL should suffice.
return NULL;
}
- fread(ri, sizeof(Ray_info), 1, in);
+ if (fread(ri, sizeof(Ray_info), 1, in) != 1) {
+ perror("dorade_read_ray_info: fread");
+ return NULL;
+ }
/* Now, convert from Big Endian. */
if (do_swap) {
swap_4_bytes(&ri->len);
* the place of ASIB when radar is grounded.
*/
- fread(pi->code, sizeof(pi->code), 1, in);
- fread(&pi->len, sizeof(pi->len), 1, in);
+ if (fread(pi->code, sizeof(pi->code), 1, in) != 1 ||
+ fread(&pi->len, sizeof(pi->len), 1, in) != 1) {
+ perror("dorade_read_platform_info: fread");
+ return NULL;
+ }
if (do_swap) swap_4_bytes(&pi->len);
len_first_two = sizeof(pi->code) + sizeof(pi->len);
if (strncmp(pi->code, "ASIB", 4) == 0) {
- fread(&pi->longitude, sizeof(Platform_info)-len_first_two, 1, in);
+ if (fread(&pi->longitude, sizeof(Platform_info)-len_first_two, 1, in) != 1) {
+ perror("dorade_read_platform_info: fread");
+ return NULL;
+ }
/* Read past any extra bytes. */
if (pi->len > sizeof(Platform_info)) {
if (read_extra_bytes(pi->len - sizeof(Platform_info), in) <= 0)
return NULL;
}
- fread(&pd->code, sizeof(pd->code), 1, in);
- fread(&pd->len, sizeof(pd->len), 1, in);
- fread(&pd->name, sizeof(pd->name), 1, in);
+ if (fread(&pd->code, sizeof(pd->code), 1, in) != 1 ||
+ fread(&pd->len, sizeof(pd->len), 1, in) != 1 ||
+ fread(&pd->name, sizeof(pd->name), 1, in) != 1) {
+ perror("dorade_read_parameter_data: fread");
+ return NULL;
+ }
if (do_swap) swap_4_bytes(&pd->len);
/* Length is in parameter data block? or calculate if from pd->len. */
perror("dorade_read_parameter_data: pd->data");
return pd;
}
- fread(pd->data, sizeof(char), len, in);
+ if (fread(pd->data, sizeof(char), len, in) != len) {
+ perror("dorade_read_parameter_data: fread");
+ return NULL;
+ }
/* FIXME: Big endian conversion in caller? Is that the right place? */
int datum, missing_data_flag;
float prf;
- float (*f)(Range x);
- Range (*invf)(float x);
-
FILE *fp;
Comment_block *cb;
Volume_desc *vd;
if (no_command("gzip --version > /dev/null 2>&1")) return fp;
save_fd = dup(0);
close(0); /* Redirect stdin for gzip. */
- dup(fileno(fp));
+ if (dup(fileno(fp)) < 0) {
+ perror("decompress_pipe");
+ return NULL;
+ }
fpipe = popen("gzip -q -d -f --stdout", "r");
if (fpipe == NULL) perror("uncompress_pipe");
close(0);
- dup(save_fd);
+ if (dup(save_fd) < 0) {
+ perror("decompress_pipe");
+ return NULL;
+ }
close(save_fd);
return fpipe;
}
fflush(NULL); /* Flush all buffered output before opening this pipe. */
save_fd = dup(1);
close(1); /* Redirect stdout for gzip. */
- dup(fileno(fp));
+ if (dup(fileno(fp)) < 0) {
+ perror("compress_pipe");
+ return NULL;
+ }
fpipe = popen("gzip -q -1 -c", "w");
if (fpipe == NULL) perror("compress_pipe");
close(1);
- dup(save_fd);
+ if (dup(save_fd) < 0) {
+ perror("compress_pipe");
+ return NULL;
+ }
return fpipe;
}
outvect[i] = (unsigned char) (255 + f(r->range[i]));
for(i=0; i<r->h.nbins; i++)
- (void)fwrite(color_table[outvect[i]], sizeof(char), 3, fp);
+ if (fwrite(color_table[outvect[i]], sizeof(char), 3, fp) != 3)
+ fprintf(stderr, "RSL_bscan_ray: short write\n");
}
void RSL_bscan_sweep(Sweep *s, char *outfile)
else {
memset(outvect, 0, nbins);
for(i=0; i<nbins; i++)
- (void)fwrite(color_table[outvect[i]], sizeof(char), 3, fp);
+ if (fwrite(color_table[outvect[i]], sizeof(char), 3, fp) != 3)
+ fprintf(stderr, "RSL_bscan_sweep: short write\n");
}
}
(void)sprintf(pipecmd, "ppmtopict > %s 2>/dev/null", outfile);
fpipe = popen(pipecmd, "w"); /* Global FILE * */
fprintf(fpipe, "P6\n# %s\n%d %d\n255\n",outfile, xdim, ydim);
- for (i=0; i<nbytes; i++) (void)fwrite(c_table[image[i]], sizeof(char), 3, fpipe);
+ for (i=0; i<nbytes; i++)
+ if (fwrite(c_table[image[i]], sizeof(char), 3, fpipe) != 3)
+ fprintf(stderr, "RSL_write_pict: short write\n");
(void)pclose(fpipe);
}
/**********************************************************************/
nbytes = xdim*ydim;
fpipe = fopen(outfile, "w"); /* Global FILE * */
fprintf(fpipe, "P6\n# %s\n%d %d\n255\n",outfile, xdim, ydim);
- for (i=0; i<nbytes; i++) (void)fwrite(c_table[image[i]], sizeof(char), 3, fpipe);
+ for (i=0; i<nbytes; i++)
+ if (fwrite(c_table[image[i]], sizeof(char), 3, fpipe) != 3)
+ fprintf(stderr, "RSL_write_ppm: short write\n");
(void)fclose(fpipe);
}
/**********************************************************************/
(void)sprintf(pipecmd, "gzip > %s.gz 2>/dev/null", outfile);
fpipe = popen(pipecmd, "w"); /* Global FILE * */
fprintf(fpipe, "P5\n# %s\n%d %d\n255\n",outfile, xdim, ydim);
- (void)fwrite(image, sizeof(char), nbytes, fpipe);
+ if (fwrite(image, sizeof(char), nbytes, fpipe) != nbytes)
+ fprintf(stderr, "RSL_write_pgm: short write\n");
(void)pclose(fpipe);
/* The following is commented and is for non compressed. */
NSIG_Sweep **nsig_read_sweep(FILE *fp, NSIG_Product_file *prod_file)
{
NSIG_Sweep **s;
- int i, j, n;
+ int i, n;
static NSIG_Ingest_data_header **idh = NULL;
static NSIG_Raw_prod_bhdr *bhdr = NULL;
NSIG_Ray *nsig_ray;
int data_mask, iray, nrays[12], max_rays;
+#ifdef NSIG_VER2
+ int j;
int masks[5];
+#endif
int nparams;
int is_new_ray;
int idtype[12];
NSIG_Product_file *prod_file;
short id;
int data_mask, nrays;
+#ifdef NSIG_VER2
int masks[5];
+#endif
int nparams, nsweeps;
NSIG_Sweep **nsig_sweep;
NSIG_Ray *ray_p;
void RSL_print_version()
{
- printf("RSL version %s.\n", RSL_VERSION_STR);
+ printf("RSL version %s.\n", VERSION);
}
/* Debug printing global variable: radar_verbose_flag */
ray_num = 0;
if (radar_verbose_flag)
fprintf(stderr,"Processing sweep %d for %d rays.", i, nrays);
- if (radar_verbose_flag)
+ if (radar_verbose_flag) {
if (little_endian()) fprintf(stderr," ... On Little endian.\n");
else fprintf(stderr,"\n");
+ }
/* Now LOOP for all rays within this particular sweep (i).
uf_ma[37] = tm->tm_year % 100; /* Same format as data year */
uf_ma[38] = tm->tm_mon+1;
uf_ma[39] = tm->tm_mday;
- memcpy(&uf_ma[40], "RSL" RSL_VERSION_STR, 8);
+ memcpy(&uf_ma[40], "RSL" VERSION, 8);
if (little_endian()) swap2(&uf_ma[40], 8/2);
uf_ma[44] = (signed short)UF_NO_DATA;
len_ma = 45;
rec_len =(int)uf_ma[1]*2;
save_rec_len = rec_len; /* We destroy 'rec_len' when making it
big endian on a little endian machine. */
- if (little_endian()) swap_4_bytes(&rec_len);
- (void)fwrite(&rec_len, sizeof(int), 1, fp);
- if (little_endian()) swap_uf_buffer(uf);
- (void)fwrite(uf, sizeof(char), save_rec_len, fp);
- (void)fwrite(&rec_len, sizeof(int), 1, fp);
+ if (little_endian())
+ swap_4_bytes(&rec_len);
+ if (fwrite(&rec_len, sizeof(int), 1, fp) != 1)
+ perror("RSL_radar_to_uf_fp: short write");
+ if (little_endian())
+ swap_uf_buffer(uf);
+ if (fwrite(uf, sizeof(char), save_rec_len, fp) != 1)
+ perror("RSL_radar_to_uf_fp: short write");
+ if (fwrite(&rec_len, sizeof(int), 1, fp) != 1)
+ perror("RSL_radar_to_uf_fp: short write");
} /* if (ray) */
}
}
int labelnum, az_start, az_stop, pw_code, prf_high, prf_low, zdata;
int vdata, wdata, unfolding, cdata, ddata, uzdata;
float elev, az_step, az_rate, range_stop;
- char label;
sscanf(buf, "%*c%d : %f %d %d %f %f %d %d %d %d %d %d %d %f %d %d %d",
&labelnum, &elev, &az_start, &az_stop, &az_step,
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "rsl.h"
#include "rainbow.h"
Rainbow_hdr rainbow_hdr;
struct dms latdms, londms;
+ void read_rainbow_header(Rainbow_hdr *, FILE *);
+
/* These next lines allow program to read from a regular file, a
* compressed file, or standard input. I lifted them from RSL_uf_to_radar
* by John Merritt.
* and sweeps continues for the remainder of sweeps in the volume scan.
*/
- int iray, isweep, nread, nsweeps, nrays, nbins, vol_index;
+ int iray, isweep, nread, nsweeps, nrays, nbins;
unsigned char *rainbow_ray;
Volume *v;
Sweep *sweep;
Ray *ray;
int i;
float azim_rate, beam_width, dz, elev_angle, prf, unam_rng;
+ int vol_index = VR_INDEX;
beam_width = 1.0; /* for now */
if (nrays != 360) {
fprintf(stderr,"WARNING: number of rays computed is not the number "
"expected.\n");
- fprintf(stderr,"Computed = nrays: azstart = %d, az_stop = %d, "
- "az_step = %f\n");
+ fprintf(stderr,"Computed = nrays: "
+ "azstart = %d, az_stop = %d, az_step = %f\n",
+ rainbow_hdr.az_start, rainbow_hdr.az_stop, rainbow_hdr.az_step);
fprintf(stderr,"Expected 360\n");
}
radar->v[vol_index] = RSL_new_volume(nsweeps);
#include <stdio.h>
#include "rapic_routines.h"
-#include "rapic.h"
+#include "rapic_parse.h"
#include <string.h>
/*
%}
-
+%option nounput
+%option noinput
%x ATMODE
%%
}
}
fp = uncompress_pipe(fp); /* Transparently gunzip. */
- close(0); dup(fileno(fp)); /* Redirect stdin. */
+ close(0);
+ if (dup(fileno(fp)) < 0) /* Redirect stdin. */
+ return NULL;
rapicparse();
radar = rapic_radar;
Ray *r;
int nbins;
- (void)fread(header_buf, sizeof(char), sizeof(header_buf), fp);
- (void)fread(&nbins, sizeof(int), 1, fp);
+ if (fread(header_buf, sizeof(header_buf), 1, fp) != 1 ||
+ fread(&nbins, sizeof(int), 1, fp) != 1) {
+ perror("RSL_read_ray: fread");
+ return NULL;
+ }
if (nbins == 0) return NULL;
memcpy(&ray_h, header_buf, sizeof(Ray_header));
r = RSL_new_ray(ray_h.nbins);
r->h = ray_h;
- (void)fread(r->range, sizeof(Range), r->h.nbins, fp);
+ if (fread(r->range, sizeof(Range), r->h.nbins, fp) != r->h.nbins) {
+ perror("RSL_read_ray: fread");
+ return NULL;
+ }
return r;
}
Sweep *RSL_read_sweep(FILE *fp)
Sweep *s;
int nrays;
- (void)fread(header_buf, sizeof(char), sizeof(header_buf), fp);
-
- (void)fread(&nrays, sizeof(int), 1, fp);
+ if (fread(header_buf, sizeof(header_buf), 1, fp) != 1 ||
+ fread(&nrays, sizeof(int), 1, fp) != 1) {
+ perror("RSL_read_sweep: fread");
+ return NULL;
+ }
if (nrays == 0) return NULL;
if (radar_verbose_flag)
Volume *v;
int nsweeps;
-
-
- (void)fread(header_buf, sizeof(char), sizeof(header_buf), fp);
- (void)fread(&nsweeps, sizeof(int), 1, fp);
+ if (fread(header_buf, sizeof(header_buf), 1, fp) != 1 ||
+ fread(&nsweeps, sizeof(int), 1, fp) != 1) {
+ perror("RSL_read_volume: fread");
+ return NULL;
+ }
if (nsweeps == 0) return NULL;
if (radar_verbose_flag)
return NULL;
}
fp = uncompress_pipe(fp);
- (void)fread(title, sizeof(char), sizeof(title), fp);
+ if (fread(title, sizeof(title), 1, fp) != 1) {
+ perror("RSL_read_radar: fread");
+ return NULL;
+ }
if (strncmp(title, "RSL", 3) != 0) return NULL;
- (void)fread(header_buf, sizeof(char), sizeof(header_buf), fp);
+ if (fread(header_buf, sizeof(header_buf), 1, fp) != 1) {
+ perror("RSL_read_radar: fread");
+ return NULL;
+ }
memcpy(&radar_h, header_buf, sizeof(Radar_header));
radar = RSL_new_radar(MAX_RADAR_VOLUMES);
radar->h = radar_h;
- (void)fread(&nradar, sizeof(int), 1, fp);
+ if (fread(&nradar, sizeof(int), 1, fp) != 1) {
+ perror("RSL_read_radar: fread");
+ return NULL;
+ }
if (radar_verbose_flag)
fprintf(stderr,"Reading %d volumes.\n", nradar);
if (radar == NULL) return 0;
memset(title, 0, sizeof(title));
- (void)sprintf(title, "RSL v%s. sizeof(Range) %d", RSL_VERSION_STR, sizeof(Range));
+ (void)sprintf(title, "RSL v%s. sizeof(Range) %d", VERSION, sizeof(Range));
n += fwrite(title, sizeof(char), sizeof(title), fp);
memset(header_buf, 0, sizeof(header_buf));
#include "config.h"
#endif
-#define RSL_VERSION_STR "v1.41"
-
/**********************************************************************/
/* Configure: Define USE_TWO_BYTE_PRECISION to have RSL store internal*/
/* values with two bytes. Otherwise, use one byte. */
/* so you shouldn't have to modify anything here. */
/**********************************************************************/
#ifndef COLORDIR
-#define COLORDIR "/usr/local/trmm/GVBOX/lib/colors"
+#define COLORDIR DATADIR "/colors"
#endif
/* These are the color table indexes. See RSL_set/get_color_table. */
/* The default color tables for reflectivity, velocity, spectral width,
* height, rainfall, and zdr.
*/
-#define REFL_RED_FILE COLORDIR "/red_reflectivity.clr"
-#define REFL_GREEN_FILE COLORDIR "/grn_reflectivity.clr"
-#define REFL_BLUE_FILE COLORDIR "/blu_reflectivity.clr"
-#define VEL_RED_FILE COLORDIR "/red_velocity.clr"
-#define VEL_GREEN_FILE COLORDIR "/grn_velocity.clr"
-#define VEL_BLUE_FILE COLORDIR "/blu_velocity.clr"
-#define SW_RED_FILE COLORDIR "/red_spectral_width.clr"
-#define SW_GREEN_FILE COLORDIR "/grn_spectral_width.clr"
-#define SW_BLUE_FILE COLORDIR "/blu_spectral_width.clr"
-#define HEIGHT_RED_FILE COLORDIR "/red_height.clr"
-#define HEIGHT_GREEN_FILE COLORDIR "/grn_height.clr"
-#define HEIGHT_BLUE_FILE COLORDIR "/blu_height.clr"
+#define REFL_RED_FILE COLORDIR "/red_reflectivity.clr"
+#define REFL_GREEN_FILE COLORDIR "/grn_reflectivity.clr"
+#define REFL_BLUE_FILE COLORDIR "/blu_reflectivity.clr"
+#define VEL_RED_FILE COLORDIR "/red_velocity.clr"
+#define VEL_GREEN_FILE COLORDIR "/grn_velocity.clr"
+#define VEL_BLUE_FILE COLORDIR "/blu_velocity.clr"
+#define SW_RED_FILE COLORDIR "/red_spectral_width.clr"
+#define SW_GREEN_FILE COLORDIR "/grn_spectral_width.clr"
+#define SW_BLUE_FILE COLORDIR "/blu_spectral_width.clr"
+#define HEIGHT_RED_FILE COLORDIR "/red_height.clr"
+#define HEIGHT_GREEN_FILE COLORDIR "/grn_height.clr"
+#define HEIGHT_BLUE_FILE COLORDIR "/blu_height.clr"
#define RAINFALL_RED_FILE COLORDIR "/red_rainfall.clr"
#define RAINFALL_GREEN_FILE COLORDIR "/grn_rainfall.clr"
#define RAINFALL_BLUE_FILE COLORDIR "/blu_rainfall.clr"
nbytes = magic.word;
if (little_endian()) swap_4_bytes(&nbytes);
memcpy(uf, &magic.buf[4], 2);
- (void)fread(&uf[1], sizeof(char), nbytes-2, fp);
+ if (fread(&uf[1], sizeof(char), nbytes-2, fp) != nbytes-2)
+ perror("RSL_uf_to_radar_fp: short read");
if (little_endian()) swap_uf_buffer(uf);
- (void)fread(&nbytes, sizeof(int), 1, fp);
+ if (fread(&nbytes, sizeof(int), 1, fp) != 1)
+ perror("RSL_uf_to_radar_fp: short read");
if (uf_into_radar(uf, &radar) == UF_DONE) break;
/* Now the rest of the file. */
while(fread(&nbytes, sizeof(int), 1, fp) > 0) {
if (little_endian()) swap_4_bytes(&nbytes);
- (void)fread(uf, sizeof(char), nbytes, fp);
+ if (fread(uf, sizeof(char), nbytes, fp) != nbytes)
+ perror("RSL_uf_to_radar_fp: short read");
if (little_endian()) swap_uf_buffer(uf);
- (void)fread(&nbytes, sizeof(int), 1, fp);
+ if (fread(&nbytes, sizeof(int), 1, fp) != 1)
+ perror("RSL_uf_to_radar_fp: short read");
if (uf_into_radar(uf, &radar) == UF_DONE) break;
}
sbytes = magic.sword;
if (little_endian()) swap_2_bytes(&sbytes);
memcpy(uf, &magic.buf[2], 4);
- (void)fread(&uf[2], sizeof(char), sbytes-4, fp);
+ if (fread(&uf[2], sizeof(char), sbytes-4, fp) != sbytes-4)
+ perror("RSL_uf_to_radar_fp: short read");
if (little_endian()) swap_uf_buffer(uf);
- (void)fread(&sbytes, sizeof(short), 1, fp);
+ if (fread(&sbytes, sizeof(short), 1, fp) != 1)
+ perror("RSL_uf_to_radar_fp: short read");
uf_into_radar(uf, &radar);
/* Now the rest of the file. */
while(fread(&sbytes, sizeof(short), 1, fp) > 0) {
if (little_endian()) swap_2_bytes(&sbytes);
- (void)fread(uf, sizeof(char), sbytes, fp);
+ if (fread(uf, sizeof(char), sbytes, fp) != sbytes)
+ perror("RSL_uf_to_radar_fp: short read");
if (little_endian()) swap_uf_buffer(uf);
- (void)fread(&sbytes, sizeof(short), 1, fp);
+ if (fread(&sbytes, sizeof(short), 1, fp) != 1)
+ perror("RSL_uf_to_radar_fp: short read");
if (uf_into_radar(uf, &radar) == UF_DONE) break;
}
if (little_endian()) swap_2_bytes(&sbytes); /* # of 2 byte words. */
memcpy(uf, &magic.buf[0], 6);
- (void)fread(&uf[3], sizeof(short), sbytes-3, fp);
+ if (fread(&uf[3], sizeof(short), sbytes-3, fp) != sbytes-3)
+ perror("RSL_uf_to_radar_fp: short read");
if (little_endian()) swap_uf_buffer(uf);
uf_into_radar(uf, &radar);
/* Now the rest of the file. */
memcpy(&sbytes, &uf[1], 2); /* Record length is in word #2. */
if (little_endian()) swap_2_bytes(&sbytes);
- (void)fread(&uf[2], sizeof(short), sbytes-2, fp); /* Have words 1,2. */
+ if (fread(&uf[2], sizeof(short), sbytes-2, fp) != sbytes-2)
+ perror("RSL_uf_to_radar_fp: short read"); /* Have words 1,2. */
if (little_endian()) swap_uf_buffer(uf);
if (uf_into_radar(uf, &radar) == UF_DONE) break;
* The directory should be the same as the LIBDIR in the makefile.
*/
#ifndef WSR88D_SITE_INFO_FILE
-#define WSR88D_SITE_INFO_FILE "/usr/local/trmm/GVBOX/lib/wsr88d_locations.dat"
+#define WSR88D_SITE_INFO_FILE DATADIR "/wsr88d_locations.dat"
#endif
/*===============================================================*/
typedef struct {
int *field_offset;
int ifield, nfields;
int iray;
- const nconstblocks = 3;
+ const int nconstblocks = 3;
Data_moment_hdr data_hdr;
int ngates, do_swap;
unsigned short item;
float value, scale, offset;
unsigned char *data;
- Range (*invf)(float x);
- float (*f)(Range x);
Ray *ray;
int vol_index, waveform;
- char *type_str;
+ Range (*invf)(float x) = DZ_INVF;
+ float (*f)(Range x) = DZ_F;
+ char *type_str = "Unknown type";
int keep_hi_prf_dz = 0; /* TODO: make this an argument. */
if (data_hdr.scale == 0) scale = 1.0;
data = &wsr88d_ray->data[data_index];
for (i = 0; i < ngates; i++) {
- if (data_hdr.datasize_bits != 16) {
- item = *data;
- data++;
- } else {
- item = *(unsigned short *)data;
+ if (data_hdr.datasize_bits == 16) {
+ item = ((unsigned short *)data)[i];
if (do_swap) swap_2_bytes(&item);
- data += 2;
+ } else {
+ item = ((unsigned char *)data)[i];
}
if (item > 1)
value = (item - offset) / scale;