Skip to content

Commit

Permalink
fix load snow state
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Aug 19, 2024
1 parent f949dbd commit c893148
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
19 changes: 18 additions & 1 deletion agrolib/snow/snowMaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void Crit3DSnowMaps::initializeSnowMaps(const gis::Crit3DRasterGrid &dtm, double
}


void Crit3DSnowMaps::updateMap(Crit3DSnow &snowPoint, int row, int col)
void Crit3DSnowMaps::updateMapRowCol(Crit3DSnow &snowPoint, int row, int col)
{
_snowWaterEquivalentMap->value[row][col] = float(snowPoint.getSnowWaterEquivalent());
_iceContentMap->value[row][col] = float(snowPoint.getIceContent());
Expand All @@ -122,6 +122,23 @@ void Crit3DSnowMaps::updateMap(Crit3DSnow &snowPoint, int row, int col)
}


void Crit3DSnowMaps::flagMapRowCol(int row, int col)
{
_snowWaterEquivalentMap->value[row][col] = _snowWaterEquivalentMap->header->flag;
_iceContentMap->value[row][col] = _iceContentMap->header->flag;
_liquidWaterContentMap->value[row][col] = _liquidWaterContentMap->header->flag;
_internalEnergyMap->value[row][col] = _internalEnergyMap->header->flag;
_surfaceEnergyMap->value[row][col] = _surfaceEnergyMap->header->flag;
_snowSurfaceTempMap->value[row][col] = _snowSurfaceTempMap->header->flag;
_ageOfSnowMap->value[row][col] = _ageOfSnowMap->header->flag;

_snowFallMap->value[row][col] = _snowFallMap->header->flag;
_snowMeltMap->value[row][col] = _snowMeltMap->header->flag;
_sensibleHeatMap->value[row][col] = _sensibleHeatMap->header->flag;
_latentHeatMap->value[row][col] = _latentHeatMap->header->flag;
}


void Crit3DSnowMaps::updateRangeMaps()
{
gis::updateMinMaxRasterGrid(_snowWaterEquivalentMap);
Expand Down
4 changes: 3 additions & 1 deletion agrolib/snow/snowMaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
void initializeSnowMaps(const gis::Crit3DRasterGrid &dtm, double skinThickness);
void resetSnowModel(double skinThickness);

void updateMap(Crit3DSnow &snowPoint, int row, int col);
void updateMapRowCol(Crit3DSnow &snowPoint, int row, int col);
void flagMapRowCol(int row, int col);

void setPoint(Crit3DSnow &snowPoint, int row, int col);

void updateRangeMaps();
Expand Down
7 changes: 6 additions & 1 deletion bin/CRITERIA3D/criteria3DProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ void Crit3DProject::computeSnowPoint(int row, int col)

snowModel.computeSnowBrooksModel();

snowMaps.updateMap(snowModel, row, col);
snowMaps.updateMapRowCol(snowModel, row, col);
}


Expand Down Expand Up @@ -1047,8 +1047,13 @@ bool Crit3DProject::computeSnowModel()
{
computeSnowPoint(row, col);
}
else
{
snowMaps.flagMapRowCol(row, col);
}
}
}

snowMaps.updateRangeMaps();
}

Expand Down

0 comments on commit c893148

Please sign in to comment.