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

rain.h File Reference

Header file for acquiring rainfall grid_io data. More...

#include "gridmap.h"
#include "globals.h"

Include dependency graph for rain.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int rain_data_wmm (float *)
VOIDP nalloc (unsigned mem_size, const char var_name[])
 Allocate memory for a variable.

Variables

applicationStruct rain_struct
char rain_binfilename [135]
char * ModelPath
char * ProjName


Detailed Description

Header file for acquiring rainfall grid_io data.

This defines or declares variables & functions that are global to rain_inp.c.

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

The Everglades Landscape Model (ELM).
last updated: Jan 2005

Definition in file rain.h.


Function Documentation

int rain_data_wmm float *   ) 
 

rainfall data array

Definition at line 26 of file rain_inp.c.

Referenced by cell_dyn1().

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 }

VOIDP nalloc unsigned  mem_size,
const char  var_name[]
 

Allocate memory for a variable.

Parameters:
mem_size The size of memory space
var_name The variable's name
Returns:
Pointer to that memory

Definition at line 1774 of file Driver_Utilities.c.

01775 {
01776   VOIDP rp;
01777 
01778   
01779   if(mem_size == 0) return(NULL);
01780   rp = (VOIDP)malloc( mem_size );
01781   total_memory += mem_size;
01782   fasync(stderr);
01783   if( rp == NULL ) {
01784     fprintf(stderr,"Sorry, out of memory(%d): %s\n",mem_size,var_name);
01785     Exit(0);
01786   }
01787   fmulti(stderr);
01788   return(rp);
01789 }


Variable Documentation

applicationStruct rain_struct
 

Definition at line 18 of file rain.h.

Referenced by rain_data_wmm().

char rain_binfilename[135]
 

grid_io binary data file name

Definition at line 20 of file rain.h.

Referenced by rain_data_wmm().

char* ModelPath
 

Environment variables used in model

ModelPath environment variable, base pathname for executable and input data
ProjName environment variable, the name of the model project
DriverPath environment variable, base pathname for source code
OS_TYPE environment variable, the type of operating system being used (informational purpose only, not used in code)

Definition at line 36 of file driver_utilities.h.

char * ProjName
 

Environment variables used in model

ModelPath environment variable, base pathname for executable and input data
ProjName environment variable, the name of the model project
DriverPath environment variable, base pathname for source code
OS_TYPE environment variable, the type of operating system being used (informational purpose only, not used in code)

Definition at line 36 of file driver_utilities.h.


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