#include "dcltng.h" void lt_trmm() /************************************************************************ * lt_trmm * * * * This program reads TRMM lightning data files. The format is * * something like: * * YYYY-JJJ HH MM SS ssss lat lon * * intensity ( micro joules/ster/meter**2 ) * * 2003-021T10:18:19.6105 -32.382 -41.630 69197.0 * * * * * ** * * Log: * * S. Guan/NCEP 10/08 Initial version * * S. Guan/NCEP 01/09 Reconstruct * ***********************************************************************/ { double lat; double lon; double intensity; int kamps; unsigned int tenths; unsigned int multi; unsigned int hrs; unsigned int mins; unsigned int secs; unsigned int year; unsigned int month; unsigned int julian; unsigned int day; int fields; struct tm strike_time; time_t rep_seconds; /* * We never have multi or kamps in TRMM data */ kamps = 0; multi = 0; /* * Now read data until EOF, or until we timeout */ while (!feof(stdin)) { fields = fscanf(stdin, "%d-%dT%d:%d:%d.%d %lf %lf %lf\n", &year, &julian, &hrs, &mins, &secs, &tenths, &lat, &lon, &intensity); if (fields == 9) { /* Only keep the tenths part */ tenths = tenths / 1000; /* Convert the date to seconds since epoch */ memset(&strike_time, 0, sizeof(struct tm)); strike_time.tm_sec = secs; strike_time.tm_min = mins; strike_time.tm_hour = hrs; strike_time.tm_year = year - 1900; rep_seconds = mktime(&strike_time) + julian * 86400; } } }