Esempio n. 1
0
 /*****************************************************************************
   InitMetMaps()
 *****************************************************************************/
void InitMetMaps(int NDaySteps, MAPSIZE *Map, MAPSIZE *Radar,
  OPTIONSTRUCT *Options, char *WindPath, char *PrecipLapseFile,
  float ***PrecipLapseMap, float ***PrismMap,
  unsigned char ****ShadowMap, float ***SkyViewMap,
  EVAPPIX ***EvapMap, PRECIPPIX ***PrecipMap,
  RADARPIX ***RadarMap, PIXRAD ***RadMap,
  SOILPIX **SoilMap, LAYER *Soil, VEGPIX **VegMap,
  LAYER *Veg, TOPOPIX **TopoMap, float ****MM5Input,
  float ****WindModel)
{
  int y, x;

  printf("Initializing meteorological maps\n");

  InitEvapMap(Map, EvapMap, SoilMap, Soil, VegMap, Veg, TopoMap);
  InitPrecipMap(Map, PrecipMap, VegMap, Veg, TopoMap);

  if (Options->MM5 == TRUE) {
    InitMM5Maps(Soil->MaxLayers, Map->NY, Map->NX, MM5Input, RadMap, Options);
    if (Options->Shading == TRUE)
      InitShadeMap(Options, NDaySteps, Map->NY, Map->NX, ShadowMap, SkyViewMap);
  }
  else {
    if (Options->PrecipType == RADAR)
      InitRadarMap(Radar, RadarMap);
    if (Options->PrecipLapse == MAP)
      InitPrecipLapseMap(PrecipLapseFile, Map->NY, Map->NX, PrecipLapseMap);
    if (Options->Prism == TRUE)
      InitPrismMap(Map->NY, Map->NX, PrismMap);
    if (Options->Shading == TRUE)
      InitShadeMap(Options, NDaySteps, Map->NY, Map->NX, ShadowMap, SkyViewMap);

    if (!((*SkyViewMap) = (float **)calloc(Map->NY, sizeof(float *))))
      ReportError("InitMetMaps()", 1);
    for (y = 0; y < Map->NY; y++) {
      if (!((*SkyViewMap)[y] = (float *)calloc(Map->NX, sizeof(float))))
        ReportError("InitMetMaps()", 1);
    }
    for (y = 0; y < Map->NY; y++) {
      for (x = 0; x < Map->NX; x++) {
        (*SkyViewMap)[y][x] = 1.0;
      }
    }
    if (Options->WindSource == MODEL)
      InitWindModelMaps(WindPath, Map->NY, Map->NX, WindModel);

    InitRadMap(Map, RadMap);
  }
  if (Options->MM5 == TRUE && Options->QPF == TRUE && Options->Prism == TRUE)
    InitPrismMap(Map->NY, Map->NX, PrismMap);
}
Esempio n. 2
0
/*****************************************************************************
  InitMetMaps()
*****************************************************************************/
void InitMetMaps(int NDaySteps, MAPSIZE *Map, MAPSIZE *Radar,
		 OPTIONSTRUCT *Options, char *WindPath, char *PrecipLapseFile,
		 float ***PrecipLapseMap, float ***PrismMap,
		 unsigned char ****ShadowMap, float ***SkyViewMap,
		 EVAPPIX ***EvapMap, PRECIPPIX ***PrecipMap,
		 RADARPIX ***RadarMap, RADCLASSPIX ***RadMap,
		 SOILPIX **SoilMap, LAYER *Soil, VEGPIX **VegMap,
		 LAYER *Veg, TOPOPIX **TopoMap, float ****MM5Input,
		 float ****WindModel)
{
  printf("Initializing meteorological maps\n");

  InitEvapMap(Map, EvapMap, SoilMap, Soil, VegMap, Veg, TopoMap);
  InitPrecipMap(Map, PrecipMap, VegMap, Veg, TopoMap);

  if (Options->MM5 == TRUE) {
    InitMM5Maps(Soil->MaxLayers, Map->NY, Map->NX, MM5Input, RadMap, Options);
    if (Options->Shading == TRUE)
      InitShadeMap(Options, NDaySteps, Map->NY, Map->NX, ShadowMap, SkyViewMap);
  }
  else {
    if (Options->PrecipType == RADAR)
      InitRadarMap(Radar, RadarMap);
    if (Options->PrecipLapse == MAP)
      InitPrecipLapseMap(PrecipLapseFile, Map->NY, Map->NX, PrecipLapseMap);
    if (Options->Prism == TRUE)
      InitPrismMap(Map->NY, Map->NX, PrismMap);
    if (Options->Shading == TRUE)
      InitShadeMap(Options, NDaySteps, Map->NY, Map->NX, ShadowMap, SkyViewMap);
    if (Options->WindSource == MODEL)
      InitWindModelMaps(WindPath, Map->NY, Map->NX, WindModel);

    InitRadMap(Map, RadMap);
  }
  if (Options->MM5 == TRUE && Options->QPF == TRUE && Options->Prism == TRUE)
    InitPrismMap(Map->NY, Map->NX, PrismMap);
}