head 2.3; access oasisa; symbols ; locks oasisa:2.3; strict; comment @ * @; 2.3 date 2001.06.19.13.16.22; author oasisa; state Exp; branches ; next 2.2; 2.2 date 94.01.17.11.09.53; author hebo; state Exp; branches ; next 2.1; 2.1 date 92.09.04.17.06.15; author hebo; state Exp; branches ; next 2.0; 2.0 date 92.09.01.14.23.17; author hebo; state Exp; branches ; next 1.5; 1.5 date 92.06.15.09.08.25; author hebo; state Exp; branches ; next 1.4; 1.4 date 92.03.26.16.47.25; author hebo; state Rel; branches ; next 1.3; 1.3 date 92.03.23.09.48.54; author hebo; state Rel; branches ; next 1.2; 1.2 date 92.03.20.16.15.24; author hebo; state Rel; branches ; next 1.1; 1.1 date 92.03.17.16.13.15; author hebo; state Rel; branches ; next 1.0; 1.0 date 92.02.25.10.47.00; author hebo; state Rel; branches ; next ; desc @Program to print meteorological readings from OASIS data files @ 2.3 log @Periodic Update 6/19/2001 (klh) @ text @/****************************************************************************/ /* Copyright 1992 MBARI */ /****************************************************************************/ /* $Header: m1.c,v 1.1 94/01/17 11:09:55 hebo Exp $ */ /* Summary : Program to print meteorological readings from OASIS M1 mooring*/ /* Filename : m1.c */ /* Author : Robert Herlien (rah) */ /* Project : OASIS Mooring */ /* $Revision: 1.1 $ */ /* Created : 09/24/92 */ /* */ /* MBARI provides this documentation and code "as is", with no warranty, */ /* express or implied, of its quality or consistency. It is provided without*/ /* support and without obligation on the part of the Monterey Bay Aquarium */ /* Research Institute to assist in its use, correction, modification, or */ /* enhancement. This information should not be published or distributed to */ /* third parties without specific written permission from MBARI. */ /* */ /****************************************************************************/ /* Modification History: */ /* 10feb92 rah - created */ /* $Log: m1.c,v $ * Revision 1.1 94/01/17 11:09:55 11:09:55 hebo * Misc changes * * Revision 1.0 92/09/24 10:29:53 10:29:53 hebo (Bob Herlien) * Initial revision * */ /****************************************************************************/ #include /* Standard I/O */ #include /* For exit() */ #include /* MBARI type definitions */ #include /* MBARI constants */ #include /* OASIS controller definitions */ #include /* Time */ #include /* For fmod() */ #include #define NAMESIZE 256 /* Space allocated for file names */ #define MLINELEN 95 /* Approx length of one METSYS record*/ #define CLINELEN 60 /* Approx length of one CTD record */ #define GLINELEN 52 /* Approx length of one GPS record */ #define LINEBUFLEN 512 /* Size of line buffer */ #define NRECS 150 /* Max # records displayed */ #define DFLT_RECS 20 /* Default # records displayed */ #define NFIELDS 15 /* # fields in METSYS record */ #define YEAR0 70 /* Unix Epoch year (1970) */ #define SECS_PER_DAY 86400 /* Seconds per day */ #define START_WINDOW 0.007 /* 10 minute window at start */ typedef struct /************************************/ { /* Struct for decoded Metsys data */ double met_time; /* OASIS Date/time */ Int32 met_format; /* Format code */ Int32 met_jday; /* Julian day from metsys */ Int32 met_hour; /* Hour of day reported by metsys */ Int32 met_min; /* Minute of hour reported by metsys*/ double met_battery; /* Metsys battery voltage */ double met_temp; /* Air Temperature */ double met_humid; /* Humidity */ double met_barometer; /* Barometric pressure minus 800 */ double met_windspeed; /* Wind speed in knots */ double met_winddir; /* Wind direction from */ double met_windu; /* Wind U vector */ double met_windv; /* Wind V vector */ double met_buoy_head; /* Buoy heading */ double met_windvane; /* Wind vane offset from heading */ } MetDecode; /************************************/ typedef struct { double ctd_time; CTDDecode ctdd; } CTDDec; typedef struct { double gps_time; double gps_lat; double gps_long; double gps_std; int gps_samples; int gps_status; } GPSDec; /********************************/ /* Global Data */ /********************************/ Global MetDecode metrecs[NRECS]; /* METSYS records */ Global CTDDec ctdrecs[NRECS]; /* CTD records */ Global GPSDec gpsrecs[NRECS]; /* GPS records */ Global char metsys_file[NAMESIZE]; /* Name of MetSys data file */ Global char ctd_file[NAMESIZE]; /* Name of CTD data file */ Global char gps_file[NAMESIZE]; /* Name of GPS data file */ Global char *metsys_dir = "/oasis/m1/metsys"; Global char *ctd_dir = "/oasis/m1/ctd"; Global char *gps_dir = "/oasis/m1/gps"; Global char buffer[LINEBUFLEN]; Global char *months[12] = /* Month names */ {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; Global Nat16 jdays[12] = /* Days since Jan. 1 in non-leap yr */ { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; /************************************************************************/ /* Function : julday */ /* Purpose : Calculate Julian Day given year, month, day */ /* Inputs : year (00 - 99), month (0 - 11), day (1 - 31) */ /* Outputs : Julian day */ /* Comment : Returns Julian day in range 1:366 */ /************************************************************************/ Int32 julday( Int32 yr, Int32 mo, Int32 day ) { Int32 leap; leap = (((yr % 4) == 0) && (mo > 1)) ? 1 : 0; return( jdays[mo] + day + leap ); } /* julday() */ /************************************************************************/ /* Function : ep_days */ /* Purpose : Calculate number days since Unix epoch */ /* Inputs : years since 1970, Unix-type julian day (0:365) */ /* Outputs : Days since 1/1/1970 */ /* Comment : The (year + 1)/4 term accounts for leap years, the */ /* first of which was 1972 & should be added starting '73 */ /************************************************************************/ Int32 ep_days( year, yday ) int year, yday; { return( (365 * year) + ((year + 1)/4) + yday ); } /* ep_days() */ /************************************************************************/ /* function : main */ /* purpose : Main routine */ /* inputs : argc, argv */ /* outputs : none */ /************************************************************************/ Void main( int argc, char **argv ) { time_t curtime, basetime, mtm, ctm, gtm; struct tm *tp; Int i, j, k, itime, mrecs, crecs, grecs, year, mo, yday, mday, rtn; FILE *mfp, *cfp, *gfp; double starttime; Int lat, lng; time( &curtime ); tp = gmtime( &curtime ); year = tp->tm_year; itime = (1000 * year) + tp->tm_yday + 1; mrecs = DFLT_RECS; mfp = cfp = NULLF; for ( i = 1; i < argc; i++ ) { if ( *argv[i] == '-' ) switch( argv[i][1] ) { case 'd': if ( isdigit(argv[i][2]) ) itime = atoi( &argv[i][2] ); else itime = atoi( argv[++i] ); if ( itime < 1000 ) itime += year * 1000; break; case 'f': i++; metsys_dir = argv[i]; break; case 'n': if ( isdigit(argv[i][2]) ) mrecs = atoi( &argv[i][2] ); else mrecs = atoi( argv[++i] ); if ( mrecs > NRECS ) mrecs = NRECS; break; default: printf("Unknown command line switch \"%s\"\n", argv[i]); } } sprintf( metsys_file, "%s/%05d", metsys_dir, itime ); sprintf( ctd_file, "%s/%05d", ctd_dir, itime ); sprintf( gps_file, "%s/%05d", gps_dir, itime ); mfp = fopen( metsys_file, "r" ); cfp = fopen( ctd_file, "r" ); gfp = fopen( gps_file, "r" ); crecs = mrecs; grecs = mrecs/3 + 1; starttime = 0.0; if ( mfp == NULLF ) { printf( "Could not open METSYS file %s/%05d\n", metsys_dir, itime ); mrecs = 0; } if ( cfp == NULLF ) { printf( "Could not open CTD file %s/%05d\n", ctd_dir, itime ); crecs = 0; } if ( gfp == NULLF ) { printf( "Could not open GPS file %s/%05d\n", gps_dir, itime ); grecs = 0; } if ( mfp != NULLF ) { fseek( mfp, (long)(mrecs+1) * MLINELEN * (-1), SEEK_END ); fgets(buffer, LINEBUFLEN, mfp); for ( i = 0; fgets(buffer, LINEBUFLEN, mfp) != NULL; ) { if ( buffer[0] == '#' ) continue; rtn = sscanf(buffer, " %lg %d %d %d %d %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg", &metrecs[i].met_time, &metrecs[i].met_format, &metrecs[i].met_jday, &metrecs[i].met_hour, &metrecs[i].met_min, &metrecs[i].met_battery, &metrecs[i].met_temp, &metrecs[i].met_humid, &metrecs[i].met_barometer, &metrecs[i].met_windspeed, &metrecs[i].met_winddir, &metrecs[i].met_windu, &metrecs[i].met_windv, &metrecs[i].met_buoy_head, &metrecs[i].met_windvane); if ( rtn >= NFIELDS ) i++; } fclose( mfp ); mrecs = i; } if ( mrecs <= 0 ) printf( "No MetSys data in file %s\n", metsys_file ); else starttime = metrecs[0].met_time; if ( cfp != NULLF ) { for ( i = 0; fgets(buffer, LINEBUFLEN, cfp) != NULL; ) { if ( buffer[0] == '#' ) continue; if ( sscanf(buffer, " %lg %d %lg %lg %lg %lg %lg %lg", &ctdrecs[i].ctd_time, &ctdrecs[i].ctdd.ctd_sample, &ctdrecs[i].ctdd.ctd_press, &ctdrecs[i].ctdd.ctd_temp, &ctdrecs[i].ctdd.ctd_cond, &ctdrecs[i].ctdd.ctd_sal, &ctdrecs[i].ctdd.ctd_trans, &ctdrecs[i].ctdd.ctd_fluor) >= 8 ) if ( ctdrecs[i].ctd_time > starttime - START_WINDOW ) i++; } fclose( cfp ); crecs = i; } if ( crecs <= 0 ) printf( "No CTD data in file %s\n", ctd_file ); if ( gfp != NULLF ) { for ( i = 0; fgets(buffer, LINEBUFLEN, gfp) != NULL; ) { if ( buffer[0] == '#' ) continue; if ( sscanf(buffer, " %lg %lg %lg %lg %d %d", &gpsrecs[i].gps_time, &gpsrecs[i].gps_lat, &gpsrecs[i].gps_long, &gpsrecs[i].gps_std, &gpsrecs[i].gps_samples, &gpsrecs[i].gps_status) == 6 ) if ( gpsrecs[i].gps_time > starttime - START_WINDOW ) i++; } fclose( gfp ); grecs = i; } if ( grecs <= 0 ) printf( "No GPS data in file %s\n", gps_file ); yday = itime % 1000; for ( mo = 0; (yday > julday(year,mo+1,0)) && (mo < 11); mo++ ) ; /* Loop to find month */ mday = yday - julday(year,mo,0); /* Find day of month */ /* Get time_t for 00:00. The +30 is for rounding minutes*/ basetime = ep_days(year - YEAR0, yday) * SECS_PER_DAY + 30; printf("\nLatest M1 Meteorological and CTD data from %s %d, %d (Julian day %d)\n\n", months[mo], mday, year + 1900, yday ); printf("Local Air Rel Wind Barometer Surface Salinity Position\n"); printf("Time Temp Humid kts from mbar Temp o/oo\n"); for ( i = j = k = 0; (i < mrecs); ) { mtm = basetime + (SECS_PER_DAY * fmod(metrecs[i].met_time, 1.0)); if ( j < crecs ) ctm = basetime + (SECS_PER_DAY * fmod(ctdrecs[j].ctd_time, 1.0)); else ctm = (time_t)0x7fffffff; if ( k < grecs ) gtm = basetime + (SECS_PER_DAY * fmod(gpsrecs[k].gps_time, 1.0)); else gtm = (time_t)0x7fffffff; tp = localtime(&mtm); if ( abs(ctm - mtm) <= 300 ) { printf("%2d:%02d ", tp->tm_hour, tp->tm_min); printf("%5.1f %4.0f %5.1f %3.0f %4.0f", metrecs[i].met_temp, metrecs[i].met_humid, metrecs[i].met_windspeed, metrecs[i].met_winddir, metrecs[i].met_barometer); i++; printf(" %7.3f %8.4f", ctdrecs[j].ctdd.ctd_temp, ctdrecs[j].ctdd.ctd_sal ); j++; } else if ( mtm <= ctm ) { printf("%2d:%02d ", tp->tm_hour, tp->tm_min); printf("%5.1f %4.0f %5.1f %3.0f %4.0f ", metrecs[i].met_temp, metrecs[i].met_humid, metrecs[i].met_windspeed, metrecs[i].met_winddir, metrecs[i].met_barometer); i++; } else { tp = localtime(&ctm); printf("%2d:%02d ", tp->tm_hour, tp->tm_min); printf("%7.3f %8.4f", ctdrecs[j].ctdd.ctd_temp, ctdrecs[j].ctdd.ctd_sal ); j++; } if ( gtm <= mtm + 300 ) { lat = labs((Int)gpsrecs[k].gps_lat); lng = labs((Int)gpsrecs[k].gps_long); printf( " %d:%06.3fN %d:%06.3fW", lat, (fabs(gpsrecs[k].gps_lat) - (double)lat) * 60.0, lng, (fabs(gpsrecs[k].gps_long) - (double)lng) * 60.0 ); k++; } printf("\n"); } exit( 0 ); } /* main() */ @ 2.2 log @Misc changes @ text @d4 2 a5 2 /* $Header: m1.c,v 2.1 92/09/04 17:06:15 hebo Exp $ */ /* Summary : Program to print meteorological readings from OASIS data files*/ d9 10 a18 2 /* $Revision: 2.1 $ */ /* Created : 02/10/92 */ d23 2 a24 2 * Revision 2.1 92/09/04 17:06:15 17:06:15 hebo (Bob Herlien) * Deleted ATLAS SST due to bad sensor, added GPS d26 2 a27 2 * Revision 2.0 92/09/01 14:23:17 14:23:17 hebo (Bob Herlien) * August 1992 Deployment. a28 17 * Revision 1.5 92/06/15 09:08:25 09:08:25 hebo (Bob Herlien) * Changed for 10 minute CTD sampling * * Revision 1.4 92/03/26 16:47:25 16:47:25 hebo (Bob Herlien) * Changed to print local time. * * Revision 1.3 92/03/23 09:48:54 09:48:54 hebo (Bob Herlien) * Output ATLAS, CTD on same line if time difference <= 5 minutes. * * Revision 1.2 92/03/20 16:15:24 16:15:24 hebo (Bob Herlien) * Added salinity, CTD temp * * Revision 1.1 92/03/17 16:13:15 16:13:15 hebo (Bob Herlien) * Displays OASIS time (not ATLAS), actual date (not julian day) * * Revision 1.0 92/02/25 10:47:00 10:47:00 hebo (Bob Herlien) * Initial revision d34 2 a35 2 #include /* MBARI type definitions */ #include /* MBARI constants */ d42 1 a42 1 #define ALINELEN 170 /* Approx length of one ATLAS record*/ d44 1 a44 1 #define GLINELEN 50 /* Approx length of one GPS record */ d46 3 a48 4 #define NRECS 150 /* Max # ATLAS records displayed */ #define DFLT_RECS 21 /* Default # ATLAS records displayed*/ #define NFIELDS 21 /* # fields in ATLAS record */ #define MS_TO_KTS 1.9438 /* Conversion of m/s to knots */ d53 19 d93 1 a93 1 Global AtlasDecode atlrecs[NRECS]; /* ATLAS records */ d96 1 a96 1 Global char atlas_file[NAMESIZE]; /* Name of ATLAS data file */ d99 3 a101 3 Global char *atlas_dir = "/usr/local/oasis/M1/atlas"; Global char *ctd_dir = "/usr/local/oasis/M1/ctd"; Global char *gps_dir = "/usr/local/oasis/M1/gps"; d155 1 a155 1 time_t curtime, basetime, atm, ctm, gtm; d157 3 a159 3 Int i, j, k, itime, arecs, crecs, grecs, n, year, mo, yday, mday; FILE *afp, *cfp, *gfp; double otime, starttime; d166 2 a167 2 arecs = DFLT_RECS; afp = cfp = NULLF; d185 1 a185 1 atlas_dir = argv[i]; d190 1 a190 1 arecs = atoi( &argv[i][2] ); d192 3 a194 3 arecs = atoi( argv[++i] ); if ( arecs > NRECS ) arecs = NRECS; d202 6 a207 11 for ( i = itime; itime > i - 10; itime-- ) { sprintf( atlas_file, "%s/%05d", atlas_dir, itime ); sprintf( ctd_file, "%s/%05d", ctd_dir, itime ); sprintf( gps_file, "%s/%05d", gps_dir, itime ); afp = fopen( atlas_file, "r" ); cfp = fopen( ctd_file, "r" ); gfp = fopen( gps_file, "r" ); if ( afp != NULLF ) break; } d209 2 a210 1 crecs = grecs = 0; d213 5 a217 2 if ( afp == NULLF ) printf( "Could not open ATLAS file %s/%05d\n", atlas_dir, i ); d220 4 a223 3 printf( "Could not open CTD file %s/%05d\n", ctd_dir, i ); else crecs = arecs; d226 4 a229 3 printf( "Could not open GPS file %s/%05d\n", gps_dir, i ); else grecs = arecs/3 + 1; d231 1 a231 1 if ( afp != NULLF ) d233 3 a235 2 fseek( afp, (long)arecs * ALINELEN * (-1), SEEK_END ); for ( i = 0; fgets(buffer, LINEBUFLEN, afp) != NULL; ) d239 11 a249 14 if ( sscanf(buffer, " %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg \ %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg", &otime, &atlrecs[i].atd_time, &atlrecs[i].atd_air, &atlrecs[i].atd_sst, &atlrecs[i].atd_temp[0], &atlrecs[i].atd_temp[1], &atlrecs[i].atd_temp[2], &atlrecs[i].atd_temp[3], &atlrecs[i].atd_temp[4], &atlrecs[i].atd_temp[5], &atlrecs[i].atd_temp[6], &atlrecs[i].atd_temp[7], &atlrecs[i].atd_temp[8], &atlrecs[i].atd_temp[9], &atlrecs[i].atd_press[0], &atlrecs[i].atd_press[1], &atlrecs[i].atd_rh, &atlrecs[i].atd_windspd, &atlrecs[i].atd_winddir, &atlrecs[i].atd_windu, &atlrecs[i].atd_windv) >= NFIELDS ) atlrecs[i++].atd_time = otime; d251 2 a252 2 fclose( afp ); arecs = i; d255 2 a256 2 if ( arecs <= 0 ) printf( "No ATLAS data in file %s\n", atlas_file ); d258 1 a258 1 starttime = atlrecs[0].atd_time; d310 1 a310 1 printf("\nLatest ATLAS and CTD data from %s %d, %d (Julian day %d)\n\n", d312 2 a313 2 printf("Local Air Rel Wind Direction Surface Salinity Position\n"); printf("Time Temp Humid (kts) (from) Temp o/oo\n"); d315 1 a315 1 for ( i = j = k = 0; (i < arecs); ) d317 1 a317 1 atm = basetime + (SECS_PER_DAY * fmod(atlrecs[i].atd_time, 1.0)); d326 1 a326 4 tp = localtime(&atm); n = (Int)atlrecs[i].atd_winddir + 180; if ( n >= 360 ) n -= 360; d328 1 a328 1 if ( abs(ctm - atm) <= 300 ) d331 4 a334 3 printf("%5.1f %4.0f %5.1f %3d", atlrecs[i].atd_air, atlrecs[i].atd_rh, MS_TO_KTS * atlrecs[i].atd_windspd, n); d336 1 a336 1 printf(" %7.3f %8.4f", d340 1 a340 1 else if ( atm <= ctm ) d343 4 a346 3 printf("%5.1f %4.0f %5.1f %3d ", atlrecs[i].atd_air, atlrecs[i].atd_rh, MS_TO_KTS * atlrecs[i].atd_windspd, n); d352 1 a352 1 printf("%2d:%02d ", d359 1 a359 1 if ( gtm <= atm + 300 ) @ 2.1 log @Deleted ATLAS SST due to bad sensor, added GPS @ text @d4 1 a4 1 /* $Header: m1.c,v 2.0 92/09/01 14:23:17 hebo Exp $ */ d9 1 a9 1 /* $Revision: 2.0 $ */ d15 3 d51 1 a51 1 #define ALINELEN 160 /* Approx length of one ATLAS record*/ d61 1 d90 3 a92 3 Global char *atlas_dir = "/usr/local/oasis/m1/atlas"; Global char *ctd_dir = "/usr/local/oasis/m1/ctd"; Global char *gps_dir = "/usr/local/oasis/m1/gps"; d150 1 a150 1 double otime; d205 3 d213 2 d218 2 a220 3 crecs = arecs; grecs = arecs/3 + 1; d249 2 a253 1 fseek( cfp, (long)crecs * CLINELEN * (-1), SEEK_END ); d264 2 a265 1 i++; a275 1 fseek( gfp, (long)grecs * GLINELEN * (-1), SEEK_END ); d284 2 a285 1 i++; d304 2 a305 2 printf("Local Air Rel Wind Direction Surface Salinity Position\n"); printf("Time Temp Humid (kts) (from) Temp o/oo\n"); d314 4 a317 1 gtm = basetime + (SECS_PER_DAY * fmod(gpsrecs[k].gps_time, 1.0)); d326 1 a326 1 printf("%5.1f %4.0f %5.1f %3d", d337 1 a337 1 printf("%5.1f %4.0f %5.1f %3d", d345 1 a345 1 printf("%2d:%02d ", d354 5 a358 5 lat = (Int)gpsrecs[k].gps_lat; lng = (Int)gpsrecs[k].gps_long; printf( " %d:%06.3fN %d:%06.3fW", lat, (gpsrecs[k].gps_lat - (double)lat) * 60.0, lng, (gpsrecs[k].gps_long - (double)lng) * 60.0 ); @ 2.0 log @August 1992 Deployment. @ text @d4 1 a4 1 /* $Header: m1.c,v 2.0 92/08/31 15:35:54 hebo Exp $ */ d15 2 a16 2 * Revision 2.0 92/08/31 15:35:54 15:35:54 hebo (Bob Herlien) * Auguest 1992 Deployment. Changed to allow multiple sensors of same type. d50 1 d53 1 a53 1 #define DFLT_RECS 20 /* Default # ATLAS records displayed*/ d65 11 d82 1 d85 1 d88 1 d142 1 a142 1 time_t curtime, basetime, atm, ctm; d144 2 a145 2 Int i, j, itime, arecs, crecs, n, year, mo, yday, mday; FILE *afp, *cfp; d147 1 d193 1 d196 2 a197 1 if ( (afp != NULLF) || (cfp != NULLF) ) d207 3 d211 1 d264 20 d294 2 a295 2 printf("Local Air ATLAS Rel Wind Direction CTD Salinity\n"); printf("Time Temp SST Humid (kts) (from) Temp o/oo\n"); d297 1 a297 1 for ( i = j = 0; (i < arecs); ) d304 1 d313 2 a314 2 printf("%5.1f %7.3f %4.0f %5.1f %3d", atlrecs[i].atd_air, atlrecs[i].atd_sst, atlrecs[i].atd_rh, d324 2 a325 2 printf("%5.1f %7.3f %4.0f %5.1f %3d", atlrecs[i].atd_air, atlrecs[i].atd_sst, atlrecs[i].atd_rh, d337 10 @ 1.5 log @Changed for 10 minute CTD sampling @ text @d4 1 a4 1 /* $Header: m1.c,v 1.4 92/03/26 16:47:25 hebo Rel $ */ d9 1 a9 1 /* $Revision: 1.4 $ */ d15 6 d48 1 a48 1 #define ALINELEN 150 /* Approx length of one ATLAS record*/ d72 2 a73 2 Global char *atlas_dir = "/usr/local/oasis/atlas"; Global char *ctd_dir = "/usr/local/oasis/ctd"; d177 3 a179 2 if ( ((afp = fopen(atlas_file, "r")) != NULLF) && ((cfp = fopen(ctd_file, "r")) != NULLF) ) d184 1 a184 5 { sprintf( atlas_file, "%s/%05d", atlas_dir, i ); printf( "Could not open ATLAS file %s\n", atlas_file ); exit( 1 ); } d187 1 a187 5 { sprintf( ctd_file, "%s/%05d", ctd_dir, i ); printf( "Could not open CTD file %s\n", ctd_file ); exit( 1 ); } a189 2 fseek( afp, (long)arecs * ALINELEN * (-1), SEEK_END ); fseek( cfp, (long)crecs * CLINELEN * (-1), SEEK_END ); d191 1 a191 1 for ( i = 0; fgets(buffer, LINEBUFLEN, afp) != NULL; ) d193 7 a199 4 if ( buffer[0] == '#' ) continue; if ( sscanf(buffer, " %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg \ %lg %lg %lg %lg %lg %lg %lg %lg %lg", d210 5 a214 2 >= NFIELDS ) atlrecs[i++].atd_time = otime; a216 2 fclose( afp ); arecs = i; d220 1 a220 1 for ( i = 0; fgets(buffer, LINEBUFLEN, cfp) != NULL; ) d222 15 a236 9 if ( buffer[0] == '#' ) continue; if ( sscanf(buffer, " %lg %d %lg %lg %lg %lg %lg %lg", &ctdrecs[i].ctd_time, &ctdrecs[i].ctdd.ctd_sample, &ctdrecs[i].ctdd.ctd_press, &ctdrecs[i].ctdd.ctd_temp, &ctdrecs[i].ctdd.ctd_cond, &ctdrecs[i].ctdd.ctd_sal, &ctdrecs[i].ctdd.ctd_trans, &ctdrecs[i].ctdd.ctd_fluor) >= 8 ) i++; a238 2 fclose( cfp ); crecs = i; @ 1.4 log @Changed to print local time. @ text @d4 1 a4 1 /* $Header: m1.c,v 1.4 92/03/26 15:58:50 hebo Rel $ */ d15 3 d190 1 a190 1 crecs = 2 * arecs / 3; @ 1.3 log @Output ATLAS, CTD on same line if time difference <= 5 minutes. @ text @d4 1 a4 1 /* $Header: m1.c,v 1.2 92/03/20 16:15:24 hebo Rel $ */ d9 1 a9 1 /* $Revision: 1.2 $ */ d15 3 d46 2 d93 17 d118 1 a118 1 time_t curtime; d120 1 a120 1 Int i, j, itime, arecs, crecs, n, year, mo, yday, mday, atm, ctm; d239 2 d244 1 a244 1 printf("GMT Air ATLAS Rel Wind Direction CTD Salinity\n"); d247 1 a247 1 for ( i = j = 0; (i < arecs) && (j < crecs); ) d249 6 a254 2 atm = (Int)((1440.0 * fmod(atlrecs[i].atd_time, 1.0)) + 0.5); ctm = (Int)((1440.0 * fmod(ctdrecs[j].ctd_time, 1.0)) + 0.5); d259 1 a259 1 if ( abs(ctm - atm) <= 5 ) d261 1 a261 1 printf("%2d:%02d ", atm / 60, atm % 60); d272 1 a272 1 printf("%2d:%02d ", atm / 60, atm % 60); d280 1 d282 1 a282 1 ctm / 60, ctm % 60); @ 1.2 log @Added salinity, CTD temp @ text @d4 1 a4 1 /* $Header: m1.c,v 1.2 92/03/20 11:06:13 hebo Rel $ */ d15 3 d40 1 a40 1 #define DFLT_RECS 15 /* Default # ATLAS records displayed*/ d231 1 a231 1 if ( abs(ctm - atm) <= 3 ) @ 1.1 log @Displays OASIS time (not ATLAS), actual date (not julian day) @ text @d4 1 a4 1 /* $Header: m1.c,v 1.1 92/03/17 11:13:15 hebo Rel $ */ d9 1 a9 1 /* $Revision: 1.1 $ */ d15 3 d33 2 a34 1 #define LINELEN 150 /* Approx length of one ATLAS record*/ d37 1 a37 1 #define DFLT_RECS 20 /* Default # ATLAS records displayed*/ d41 5 d52 1 d54 1 d56 1 d95 2 a96 2 Int i, itime, nrecs, n, year, mo, yday, mday; FILE *fp; d103 2 a104 2 nrecs = DFLT_RECS; fp = NULLF; d127 1 a127 1 nrecs = atoi( &argv[i][2] ); d129 3 a131 3 nrecs = atoi( argv[++i] ); if ( nrecs > NRECS ) nrecs = NRECS; d142 3 a144 1 if ( (fp = fopen(atlas_file, "r")) != NULLF ) d148 1 a148 1 if ( fp == NULLF ) d155 6 a160 1 n = fseek( fp, (long)nrecs * LINELEN * (-1), SEEK_END ); d162 5 a166 1 for ( i = 0; fgets(buffer, LINEBUFLEN, fp) != NULL; ) d186 4 a189 2 fclose( fp ); nrecs = i; d191 1 a191 1 if ( nrecs <= 0 ) d193 9 a201 2 printf( "No ATLAS data in file %s\n", atlas_file ); exit( 1 ); d204 5 d215 4 a218 5 printf("\nLatest ATLAS data from %s %d, %d\n", months[mo], mday, year + 1900 ); printf(" (Air temp sensor appears to be broken)\n\n"); printf("GMT Air Sea Rel Wind Direction\n"); printf("Time Temp Temp Humid (kts) (from)\n"); d220 1 a220 1 for ( i = 0; i < nrecs; i++ ) d222 2 a223 2 n = (Int)((1440.0 * fmod(atlrecs[i].atd_time, 1.0)) + 0.5); printf("%2d:%02d ", n / 60, n % 60); d227 29 a255 3 printf("%5.1f %5.1f %4.0f %5.1f %3d\n", atlrecs[i].atd_air, atlrecs[i].atd_sst, atlrecs[i].atd_rh, MS_TO_KTS * atlrecs[i].atd_windspd, n); @ 1.0 log @Initial revision @ text @d4 1 a4 1 /* $Header: m1.c,v 1.1 92/02/25 10:45:35 hebo Exp $ */ d15 1 a15 1 * Revision 1.1 92/02/25 10:45:35 10:45:35 hebo (Bob Herlien) a16 1 * d47 2 d50 4 d55 18 d83 1 a83 1 Int i, itime, nrecs, n; d89 2 a90 1 itime = (1000 * tp->tm_year) + tp->tm_yday + 1; d100 6 a105 2 i++; itime = atoi( argv[i] ); d117 1 a117 4 { i++; nrecs = atoi( argv[i] ); } d160 1 a160 1 i++; d172 8 a179 2 printf("\nLatest ATLAS data from Julian day %d, %d\n", (itime % 1000), (itime / 1000) + 1900 ); @