/************************************************************************* * * Header file for read_grib.c * * Contains protoypes of functions called by other routines as well * as structures used in other parts of the code * * Verion History: * * 30 March 2006 - Original written : Jonathan Mittaz */ /* Data directory - note trailing / important */ /* * The commented out version are for various test locations */ #define MAX_STRING_LENGTH_DIR 512 //#define DATA_DIR "/data/mittaz/REMOTE/level2p-oper/data/" //#define DATA_DIR "/home/jmittaz/level2p/new-operational/data/" //#define DATA_DIR "/data/oper/L2P/" char DATA_DIR[MAX_STRING_LENGTH_DIR]; /* Location of wgrib.exe */ //#define WGRIB_EXEC "/home/mittaz/mcidas/bin/wgrib.exe" //#define WGRIB_EXEC "/home/jmittaz/mcidas/bin/wgrib.x" //#define WGRIB_EXEC "/home/oper/mcidas/bin/wgrib.x" char WGRIB_EXEC[MAX_STRING_LENGTH_DIR]; char WGRIB2_EXEC[MAX_STRING_LENGTH_DIR]; /* Structures */ /* Structure that contains the atmospheric profiles and surface data * from the NCEP models */ struct modelVals { int Filled; /* Date and time of model */ int Year; int Month; int Day; int Hour; /* Data storage dimensions */ int nDims1; int nDims2; /* Start and end positions */ float minLatitude; float maxLatitude; float stepLatitude; float minLongitude; float maxLongitude; float stepLongitude; /* Parameter - number of levels */ int nLevels; float *pPressure; /* Layered variables */ float **ppHGT; float **ppTemperature; float **ppOzone; float **ppRelativeHumidity; /* Non-layered variables */ float *pSurfacePressure; float *pSurfaceTemperature; float *pTemperature2m; float *pLand; float *pIce; float *pWindSpeedU; float *pWindSpeedV; float *pTau4; }; /* Structure that contains the information derived from the SFLUX model * files - in this case all we used the the SSI */ struct modelVals2 { int Filled; /* Date and time of model */ int Year; int Month; int Day; int Hour; /* Data storage dimensions */ int nDims1; int nDims2; /* Start and end positions */ float minLatitude; float maxLatitude; float stepLatitude; float minLongitude; float maxLongitude; float stepLongitude; float *pSurfaceSolarIrradiance; }; /* Structure containing the aerosol data */ struct aerosolStr { int Filled; /* Date and time of model */ int Year; int Month; int Day; int Hour; float fltHours; /* Data storage dimensions */ int nDims1; int nDims2; /* Start and end positions */ float minLatitude; float maxLatitude; float stepLatitude; float minLongitude; float maxLongitude; float stepLongitude; float *pAerosol; float *pAerosolDate; }; /* Structure containing the previous days SST data */ struct sstStr { int Filled; /* Date and time of model */ int Year; int Month; int Day; /* Data storage dimensions */ int nDims1; int nDims2; /* Start and end positions */ float minLatitude; float maxLatitude; float stepLatitude; float minLongitude; float maxLongitude; float stepLongitude; float *pSST; }; /* Some definitions for the structures */ /* Number of long/lat values stored in model (PGRB) files */ #define NLONG 360 #define NLAT 181 /* Number of long/lat values stored in model (SFLUX) files */ /* #define NLONG2 1152 #define NLAT2 576 */ #define NLONG2 360 #define NLAT2 181 /* Number of atmospheric levels stored in model files */ #define NUMBER_OF_LEVELS 26 static int pressureArray[NUMBER_OF_LEVELS] = {10,20,30,50,70,100,150,200, 250,300,350,400,450,500,550, 600,650,700,750,800,850,900, 925,950,975,1000}; /* Start/stop points for the RH and Ozone arrays relative to the full * 26 levels defined for the other parameters */ #define MIN_RELATIVE_HUMIDITY_LEVEL 5 #define MAX_OZONE_LEVEL 6 /* Function prototypes */ void getMonthFromDayNo( int Year, int DayNo, int *pMonth, int *pDay ); void getDayNoFromMonthDay( int Year, int Month, int Day, int *pDayNo ); void subtractNewHours( int *pYearOut, int *pMonthOut, int *pDayOut, int *pNewHours, int hourStep ); void read_in_model_data( int Year, int Month, int Day, int Hour, int *pNLevels, int *pNx, int *pNy, struct modelVals *pModelVals, int Type ); void read_in_model_data2( int Year, int Month, int Day, int Hour, int *pNx, int *pNy, struct modelVals2 *pModelVals); void read_in_aerosol_data( int Year, int Month, int Day, float Hours, struct aerosolStr *pAerosol ); void read_in_previous_sst( int Year, int Month, int Day, int *pNx, int *pNy, struct sstStr *pSstVals );