Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PLUM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Land Use Lab
PLUM
Commits
71f8abcb
Commit
71f8abcb
authored
7 years ago
by
Peter Alexander
Browse files
Options
Downloads
Patches
Plain Diff
Code to output water available, to facilitate testing.
parent
ba77af55
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ac/ed/lurg/ModelMain.java
+21
-4
21 additions, 4 deletions
src/ac/ed/lurg/ModelMain.java
with
21 additions
and
4 deletions
src/ac/ed/lurg/ModelMain.java
+
21
−
4
View file @
71f8abcb
...
...
@@ -33,6 +33,8 @@ import ac.ed.lurg.demand.DemandManagerFromFile;
import
ac.ed.lurg.demand.DemandManagerSSP
;
import
ac.ed.lurg.landuse.CropUsageData
;
import
ac.ed.lurg.landuse.CropUsageReader
;
import
ac.ed.lurg.landuse.FPUManager
;
import
ac.ed.lurg.landuse.IrrigationConstraintReader
;
import
ac.ed.lurg.landuse.IrrigationItem
;
import
ac.ed.lurg.landuse.IrrigationMaxAmountReader
;
import
ac.ed.lurg.landuse.IrrigationRasterSet
;
...
...
@@ -43,7 +45,6 @@ import ac.ed.lurg.landuse.LandUseItem;
import
ac.ed.lurg.landuse.MaxCropAreaReader
;
import
ac.ed.lurg.landuse.ProtectedAreasReader
;
import
ac.ed.lurg.landuse.RunOffReader
;
import
ac.ed.lurg.landuse.FPUManager
;
import
ac.ed.lurg.output.LandUseOutputer
;
import
ac.ed.lurg.output.LpjgOutputer
;
import
ac.ed.lurg.types.CommodityType
;
...
...
@@ -365,8 +366,10 @@ public class ModelMain {
if
(
ModelConfig
.
IS_CALIBRATION_RUN
)
{
serializeLandUse
(
landUseRaster
);
if
(
timestep
.
isInitialTimestep
())
if
(
timestep
.
isInitialTimestep
())
{
outputClusters
(
clusterIdRaster
);
outputWaterAvailablity
(
currentIrrigationData
);
}
}
// Output LandUses to tabular file, for analysis (perhaps)
...
...
@@ -379,6 +382,19 @@ public class ModelMain {
// outputLandCover(timestep.getYear(), landUseRaster, LandCoverType.PASTURE);
}
private
void
outputWaterAvailablity
(
IrrigationRasterSet
irrigiationRS
)
{
new
RasterOutputer
<
Double
,
IrrigationItem
>(
irrigiationRS
,
ModelConfig
.
OUTPUT_DIR
+
File
.
separator
+
"irrig_constraint.asc"
)
{
@Override
public
Double
getValue
(
RasterKey
location
)
{
IrrigationItem
item
=
results
.
get
(
location
);
if
(
item
==
null
)
return
null
;
return
item
.
getIrrigConstraint
();
}
}.
writeOutput
();
}
private
void
outputClusters
(
RasterSet
<
IntegerRasterItem
>
landUseRaster
)
{
new
RasterOutputer
<
Integer
,
IntegerRasterItem
>(
landUseRaster
,
ModelConfig
.
CLUSTERED_YIELD_FILE
)
{
@Override
...
...
@@ -391,7 +407,7 @@ public class ModelMain {
}
}.
writeOutput
();
}
public
RasterSet
<
IntegerRasterItem
>
getClusterRaster
()
{
RasterSet
<
IntegerRasterItem
>
clusters
=
new
RasterSet
<
IntegerRasterItem
>(
desiredProjection
)
{
private
static
final
long
serialVersionUID
=
2467452274591854417L
;
...
...
@@ -555,7 +571,8 @@ public class ModelMain {
private
IrrigationRasterSet
getFixedIrrigationData
()
{
IrrigationRasterSet
fixedIrrigData
=
new
IrrigationRasterSet
(
desiredProjection
,
fpuManager
);
new
IrrigiationCostReader
(
fixedIrrigData
).
getRasterDataFromFile
(
ModelConfig
.
IRRIGATION_COST_FILE
);
return
fixedIrrigData
;
// new IrrigationConstraintReader(fixedIrrigData).getRasterDataFromFile(ModelConfig.IRRIGATION_CONSTRAINT_FILE);
return
fixedIrrigData
;
}
private
RasterSet
<
IrrigationItem
>
getUpdateIrrigationData
(
Timestep
timestep
,
YieldRaster
yieldSurfaces
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment