Ecological Landscape Modeling: Models Pages

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:

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 conv_inTOtenths_mm, applicationStruct::dataELM, applicationStruct::day, debug, elm_OG_map, elm_wmm_map, initDataStruct(), mapGrids(), ModelPath, msgStr, printGridMap(), processData(), ProjName, rain_binfilename, rain_struct, applicationStruct::recRead, returnData(), s0, s1, SimTime, T, simTime::TIME, usrErr(), and usrErr0().

Referenced by cell_dyn1().

00027 {
00028 
00029   int i,j,k; 
00030   int success = 1, fail = -1;
00031   int stat = success;
00032   char gridmapfilename[335];
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           usrErr0(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 
00058 /* initializing data structures, move pointer to initial date (gridmap.c) */
00059       stat = initDataStruct(rain_binfilename,&rain_struct);
00060 
00061       if(debug > 4) {
00062               /* printELM2Grid_io(); */
00063               /*drawELM2Grid_io(); */
00064           sprintf(msgStr,"rain_data_wmm==> Finished initializing");
00065           usrErr (msgStr); 
00066       }
00067 
00068   } /* end of SimTime.TIME=0 */
00069   
00070   
00071   if(rain_struct.day >= rain_struct.recRead) {      /* process the data in batch */
00072       sprintf(msgStr,"\nProcessing batch of rain data...");
00073       usrErr (msgStr); 
00074       stat = processData(rain_binfilename,&rain_struct);
00075 
00076       if(debug > 4 ) {
00077               /*printBatchData(rainWMM,gridio_batch_len,widCnt);*/ /* TODO: remove this printBatchData function when sure is no longer needed */
00078           sprintf(msgStr,"rain_data_wmm==> Finished processing data");
00079           usrErr (msgStr); 
00080       }
00081   } /* end of if */
00082 
00083 
00084   if (rain_struct.day < rain_struct.recRead) {      /* pass the data day by day */
00085     returnData(rainSME,&rain_struct);   
00086     /* change the unit here */
00087     for(i = 0; i < s0; i++) {
00088       for(j = 0; j < s1; j++) {
00089         k = i*s1+j;
00090         rainSME[T((i+1),(j+1))] = rain_struct.dataELM[k] * conv_inTOtenths_mm;  /* convert data from inches to tenths of mm */
00091       }
00092     } 
00093 
00094     if(debug > 4) {
00095       sprintf(msgStr,"rain_data_wmm==> Finished returning data");
00096       usrErr (msgStr); 
00097     }
00098 
00099   } /* end of if */
00100     
00101   return success;
00102 }

Here is the call graph for this function:


Generated on Sat Jan 7 14:04:35 2012 for ELM source code by  doxygen 1.5.6