Ecological Landscape Modeling: Models Pages

stage_inp.c File Reference

Establish linkage between two grids, map surface water depth (misnamed stage) input data. More...

#include "stage.h"

Include dependency graph for stage_inp.c:

Go to the source code of this file.

Functions

int stage_data_wmm (float *stageSME)


Detailed Description

Establish linkage between two grids, map surface water depth (misnamed stage) 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: Mar 2008

Definition in file stage_inp.c.


Function Documentation

int stage_data_wmm ( float *   ) 

stage (depth) data array

Definition at line 31 of file stage_inp.c.

References conv_ftTOm, applicationStruct::dataELM, applicationStruct::day, debug, elm_OG_map, elm_wmm_map, initDataStruct(), mapGrids(), ModelPath, msgStr, printGridMap(), processData(), ProjName, applicationStruct::recRead, returnData(), s0, s1, SimTime, stage_binfilename, stage_struct, T, simTime::TIME, and usrErr().

Referenced by cell_dyn1().

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

Here is the call graph for this function:


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