Everglades Landscape Model (ELM) Home Page
Main Page | Data Structures | Directories | File List | Data Fields | Globals

rain_inp.c File Reference

Establish linkage between two grids, map rainfall input data. More...

#include "rain.h"

Include dependency graph for rain_inp.c:

Include dependency graph

Go to the source code of this file.

Functions

int rain_data_wmm (float *rainSME)


Detailed Description

Establish linkage between two grids, map rainfall input data.

This has a single function.

Note: documented with Doxygen, which expects specific syntax within special comments.

The Everglades Landscape Model (ELM).
last updated: Dec 2004

Definition in file rain_inp.c.


Function Documentation

int rain_data_wmm float *   ) 
 

rainfall data array

Definition at line 26 of file rain_inp.c.

References applicationStruct::dataELM, applicationStruct::day, debug, elm_wmm_map, initDataStruct(), mapGrids(), ModelPath, msgStr, printGridMap(), processData(), ProjName, rain_binfilename, rain_struct, applicationStruct::recRead, returnData(), s1, SimTime, T, simTime::TIME, and usrErr().

00027 {
00028 
00029   int i,j,k; 
00030   int success = 1, fail = -1;
00031   int stat = success;
00032   char gridmapfilename[135];
00033 
00034   if(SimTime.TIME==0)  {      
00035 
00036      // cleanUp(*elm_wmm_map, rainSME);
00037       
00038                 /* elm_OG_map is data structure containing the mapping attributes at two scales */
00039       elm_wmm_map = elm_OG_map;
00040 
00041       if(elm_wmm_map == NULL) {
00042           sprintf(msgStr, "Mapping grids and setting up rain data...");
00043           usrErr (msgStr);
00044           
00045           sprintf(gridmapfilename, "%s%s/Data/gridmapping.txt", ModelPath, ProjName );   
00046           stat = mapGrids(gridmapfilename);
00047           elm_wmm_map = elm_OG_map;
00048       }
00049 
00050       if(debug > 4) {
00051           printGridMap();
00052           sprintf(msgStr,"rain_data_wmm==> Finished mapping grids");
00053           usrErr (msgStr);
00054       }
00055 
00056       sprintf(rain_binfilename, "%s%s/Data/rain.BIN", ModelPath, ProjName );
00057     /* initializing data structures, move pointer to initial date (gridmap.c) */
00058       stat = initDataStruct(rain_binfilename,&rain_struct);
00059 
00060       if(debug > 4) {
00061               /* printELM2Grid_io(); */
00062               /*drawELM2Grid_io(); */
00063           sprintf(msgStr,"rain_data_wmm==> Finished initializing");
00064           usrErr (msgStr); 
00065       }
00066 
00067   } /* end of SimTime.TIME=0 */
00068   
00069   
00070   if(rain_struct.day >= rain_struct.recRead) {      /* process the data in batch */
00071       sprintf(msgStr,"Processing batch of rain data...");
00072       usrErr (msgStr); 
00073       stat = processData(rain_binfilename,&rain_struct);
00074 
00075       if(debug > 4 ) {
00076               /*printBatchData(rainWMM,gridio_batch_len,widCnt);*/ /* TODO: remove this printBatchData function when sure is no longer needed */
00077           sprintf(msgStr,"rain_data_wmm==> Finished processing data");
00078           usrErr (msgStr); 
00079       }
00080   } /* end of if */
00081 
00082 
00083   if (rain_struct.day < rain_struct.recRead) {      /* pass the data day by day */
00084     returnData(rainSME,&rain_struct);   
00085     /* change the unit here */
00086     for(i = 0; i < s0; i++) {
00087       for(j = 0; j < s1; j++) {
00088         k = i*s1+j;
00089         rainSME[T((i+1),(j+1))] = rain_struct.dataELM[k] * conv_inTOtenths_mm;  /* convert data from inches to tenths of mm */
00090       }
00091     } 
00092 
00093     if(debug > 4) {
00094       sprintf(msgStr,"rain_data_wmm==> Finished returning data");
00095       usrErr (msgStr); 
00096     }
00097 
00098   } /* end of if */
00099     
00100   return success;
00101 }

Here is the call graph for this function:


Generated on Thu Jul 6 11:19:35 2006 for ELM source code by  doxygen 1.3.9.1