Sie sind auf Seite 1von 17

Snowfall

Runoff
Forecasting
in San Juan
County, UT


Dane Hurst
GIS in Water Resources
CEE 6440
Utah State University
December 5, 2014

Contents
Introduction.....................................................................................................................................................................................1
Objective......................................................................................................................................................................................1
Geography...................................................................................................................................................................................1
Methodology...................................................................................................................................................................................3
AvailableData..............................................................................................................................................................................3
ModelDevelopment....................................................................................................................................................................3
DataAnalysis...............................................................................................................................................................................5
Discussion......................................................................................................................................................................................11
Conclusion.....................................................................................................................................................................................11
References.....................................................................................................................................................................................11
AppendixACodeSamples..........................................................................................................................................................12
AverageDailySWEinIndividualSheds......................................................................................................................................12
CumulativeSeasonalSWEandPointReadings.........................................................................................................................13

Tables of Figures
Figure1.LocationMap...................................................................................................................................................................2
Figure2.EndUserProcessDiagram................................................................................................................................................4
Figure3.CampJacksonSWECorrelation........................................................................................................................................5
Figure4.BuckboardFlatSWECorrelation......................................................................................................................................5
Figure5.SouthSlopeSWESpatialVariationCorrelation................................................................................................................6
Figure6.NorthSlopeSWESpatialVariationCorrelation................................................................................................................7
Figure7.WaterYear2014CumulativeSnowWaterMap..............................................................................................................8
Figure8.StreamGaugeReadings....................................................................................................................................................9
Figure9.RecaptureCreekRunoffCorrelation..............................................................................................................................10
Figure10.SouthCreekRunoffCorrelation...................................................................................................................................10


Table1.SNODASWatershedMeanCumulativeSWE.....................................................................................................................7
Table2.WatershedAreas...............................................................................................................................................................8
Table3.ModeledWatershedAvailableSWEVolume.....................................................................................................................9

Introduction
Objective
LloydsLakeandRecaptureReservoirarereservoirsincentralSanJuanCounty,UTandarefedby
mountainstreamsfromtheAbajoMountains(locallyknownastheBlueMountains).Thesereservoirs
supportagriculture,recreationandothersecondaryusesforthecommunitiesofMonticelloand
Blanding.LikemuchoftheIntermountainWest,snowwaterisacrucialpartoftheannualwaterbudget
ofthisregion.Inanefforttoassistlocalwatermanagers,thisreportsummarizesanefforttouse
GeographicInformationSystems(GIS)toestablishasnowfallrunoffpredictionmodelforthissystem.

Geography
SanJuanCountyislocatedontheColoradoPlateauwithameanelevationof1728meters(5670feet)
abovesealevel.Theregionissemiaridandthelandscapeisaspectrumofsteepredrockcanyonsand
windsweptmesascoveredwithsagebrushtohighmountainswithponderosapineandquakingaspen.
NotablelandmarksinandborderingthecountyincludeCanyonlandsNationalPark,MonumentValley
TribalPark,theSanJuanRiverandtheColoradoRiver(includingLakePowell).
ThepopulationcenterisinthecentralpartofthecountyatthebaseoftheAbajoMountains,with
BlandingonthesouthandMonticelloonthenortheast.Anumberofreservoirssupplythese
communitieswithwaterforvarioususes,butthelargesttwo(RecaptureReservoirnearBlandingand
LloydsLakenearMonticello)arethesubjectofthisstudy.AmapofthisregionisshowninFigure1on
thefollowingpage.
Onthenorthside,astreamgaugeonSouthCreekisattheinletofLloydsLake.ThenearestSNOTEL
station(seeAvailableDataonpage3)atBuckboardFlatisapproximately1.4milesnorthwestofthe
watershedforSouthCreek.
Onthesouthside,astreamgaugeisonRecaptureCreekapproximately6milesupstreamofRecapture
Reservoir.ASNOTELstationatCampJacksonisapproximately0.6mileswestofthewatershedforthis
gauge.Withthegaugesofarupstreamofthereservoir,thereareothertributariesmostnotably
JohnsonCreekwhichcontributesignificantungaugedflowtothereservoir.TheSNOTELstationat
CampJacksonisinthewatershedforthereservoir.
Furthermore,atunnelhasbeendugthroughthemountaintobringwaterfromIndianCreekonthe
northsidetothemuchdryerJohnsonCreekwatershedonthesouthside.TheBuckboardFlatSNOTEL
stationisapproximately1.4milestothenortheastofthiswatershed.
Thisleavesfourwatershedsofinterest,twostreamgaugesandtwoSNOTELsitesinthestudyarea.
Theseareincludedonthefollowingmap.


FIGURE 1. LOCATION MAP

Methodology
Themodelwasdevelopedentirelyusinghistoricaldata.Itwashopedthatdoingsowouldaccountfor
variableslikesoilmoistureandweatherinanimplicitway.Thissimpleranalysiswaspreferred,giventhe
natureoftheprojectasasemesterlengthattemptwithanemphasisonGISratherthanhydrology.The
stepscompletedforthedevelopmentofthemodelaredescribedbelow.

AvailableData
Amajorconstraintindevelopingthismodelwastheavailabilityofdata.Thedatasetsusedaredescribed
individuallybelow.
SNOTEL(SnowTelemetry)isasystemofdatacollectionstationsoperatedbytheNationalResource
ConservationService(NRCS)inthewesternU.S.andAlaska.Itconsistsofanetworkofremotestations
thatcollectdatarelatedtosnowwater(e.g.snowwaterequivalent(SWE),soilmoistureandweather
conditions)andreportthedatainnearrealtime(1).ThestationatBuckboardFlathasbeenonlinesince
May2012andthestationatCampJacksonhasoperatedsinceOctober1985.Thedatagatheredfrom
thesesourcesincludedailymeanSWE(ininches)fortheperiodofrecord.
TheU.S.GeologicSurvey(USGS)operatesanetworkofstreamgaugesthatrecordstreamstageandflow
rateonacontinuousbasis.ThegaugeonRecaptureCreekhasbeenoperationalsinceOctober2007and
thegaugeonSouthCreekhasbeenonlinesinceOctober1985.Dailymeanflowratefortheperiodof
recordwascollectedfromeachofthesegauges.
SNODAS(SnowDataAssimilationSystem)isadataproductproducedbytheNationalOperational
HydrologicRemoteSensingCenter(NOHRSC)oftheNationalWeatherService.Itisamodelinganddata
assimilationsystemtoprovidethebestpossibleestimatesofsnowcoverandassociatedvariablesto
supporthydrologicmodelingandanalysis.Itprovides1kmresolutionestimatesofsnowdataacross
theU.S(1).Thedatacollectedfromthissystemincludedaily(forOctober1April30foreachwateryear
studied)snowwaterequivalentestimatesoverthestudyarea.
Thegeographyonthenorthandsouthslopesofthemountainwasconsidereddifferentenough(on
accountofsolarexposure)towarrantseparateanalysis.DatafromBuckboardFlatSNOTELandSouth
CreekstreamflowwereusedforcalculationsforIndianCreekandSouthCreekwatersheds.Camp
JacksonSNOTELandRecaptureCreekwerecoupledtoanalyzethetwoRecaptureCreekwatersheds.
Pairingthedatastationslikethislimitedthetemporalapplicabilityofdatainbothcases:analysisonthe
northwaslimitedbytheBuckboardFlatSNOTEL(beginningMay2012)andanalysisonthesouthwas
limitedbythestreamgaugeonRecaptureCreek(beginningOctober2007).

ModelDevelopment
ThedesiredenduserprocessdiagramisshowninFigure2.Thegoalistoallowtheusertotakea
SNOTELSWEreadingfromtheSNOTELwebsite,enteritintoanExcelsheet(representedbytheblack
box)andreceiveoutputasapredictedrunoffvalueforagivenwatershed.Insidetheblackboxthe
SNOTELmeasurementisfirstadjustedtocorrelatetotheSNODASmodel.Thatoutputisthenadjusted
toaccountforthespatialvariationofsnowfall(singlepointtoarealaverage)inthewatershed.This

averageSWEvaluecanthenbemultipliedbyareatogetanavailablevolume,thenbyarunoff
coefficienttogetpredictedrunoff.

SNOTELSWE
Reading

Correlation
toSNODAS
SWEvalueat
thesite

Average
accumulated
SWEover
watershed(s)

Correlation
tostream
flow

Predicted
available
runoff

Accountsfor
errorsin
modeled
data

Accountsfor
spatial
variationof
snowfall

Accountsfor
infiltration&
evaporation
losses

FIGURE 2. END U SER PROCESS DIAGRAM


Toestablishthefirstcorrelation(SNODAStoSNOTELSWEateachSNOTELsite)theSNODASrasters
wereprocessedtoretreivetheSWEvalueateachofthecoordinatesthenwritetheresulttoatextfile.
AsimplecorrelationwasmadebyplottingthevaluesagainstSNOTELvalues.Furtherdiscussiononthis
correlationisgiveninthefollowingsection.
TheanalysisforspatialvariationofsnowwaterrequiredthedailymeanSWEvalueineachwatershed,
calculatedusingtheSNODASrasters.Asbefore,theoutputwaswrittentoatextfileandthenplotted
againsttheSNODASSWEvalueattherespectiveSNOTELsite.Regressionanalysiswasthenusedto
establishacorrelation.
Thecorrelationofwatershedavailablevolumetostreamflowprovedtobeoneofthemostrigorous
aspectsoftheproject.Thedecisionwasmadetobaseavailablevolumeoffofaccumulatedsnowwater
overtheseason.Usingthemaximumvalueswouldlikelyhavebeenasimplertask,withnearresults,but
usingtheaccumulatedsnowfallcontrolledforanysnowmelt(andrunoff)betweensnowstorms,
especiallyinthelateseason.Thisapproachrequiredtakingthefirstrasterinthefilelistandfinding
wherethenetdifferenceinthesucceedingrasterwaspositive(wheresnowfell).Thisprocesswas
repeatedforeachraster,withtheresultofeachbeingsummedtoproduceafinalcumulativesnowfall
rasterovertheentirearea.Eachwatershedboundarywasthenusedasacookiecuttertoextractthe
dataforeachwatershedtoitsownraster.Thisprocesswasrepeatedforeachyearofthestudy.
Thestreamflowdatacameasdailyaverageflowrate.Theflowratewasconvertedtototaldailyvolume
andthenseasonaltotals(March1May31)wereplottedagainsttotalvolumeavailablecalculatedfrom
theSNODASdata,asdescribedabove.Thiscorrelationwasmadeonceforeachofthetwowatersheds
withstreamgauges,withtheintenttoapplythesamecorrelationtotheothertwowatershedsontheir
respectivesidesofthemountain.
ItshouldbenotedthattheSNODASdatawereprocessedusingPythonscripting(espceciallyutilizingthe
arcpymodule)andthescriptsareincludedhereinasAppendixA.SNOTELandstreamflowdata,together

withcorreleationstoSNODASdata,wereprocessedusingExcel.ArcGISwasusedtoveryifyresultsofthe
scripts,dosimpleprocessingsuchaswatersheddeliniationandpresentspatialdata.

DataAnalysis
Intially,thecorrelationbetweenSNODASandSNOTEL(asdescribedintheprevioussection)wasmade
usingdatafromOctober1April30foreachwateryearbecauseitwasassumedthatthisdaterange
wouldadequetlycapturethesnowfallaccumulationseason.Howeveruponplottingthedata,itwas
observedthatlateintheseasonthecorrelationbecameveryweak.Forthisreason,thetimeframewas
adjustedtoOctober1March31anually.Thecorrelationprovedtobemuchstronger.Thus,theresults
ofthemodelshouldonlybeconsideredvalidforSNOTELreadingstakenduringthistimeframe.The
resultsforthecorrelationsateachoftheSNOTELsitesareshowninFigure3andFigure4.Thedatawere
correlatedwithalinearfitwithayinterceptofzero.Esentially,thisprovidesasimplecoeffientto
correlateSNOTELandSNODAS.

Camp Jackson SWE Correlation


SNOTEL SWE (in)

30
25

y = 0.9504x
R = 0.9705

20
15
10
5
0
0

10

15

20

25

30

SNODAS SWE (in)

FIGURE 3. CAMP JACKSON SWE CORRELATION

Buckboard Flat SWE Correlation


SNODAS SWE (in)

12
10

y = 0.9527x
R = 0.9658

8
6
4
2
0
0

10

12

SNOTEL SWE (in)


FIGURE 4. BUCKBOARD FLAT SWE CORRELATION
5

ThecorrelationsforspatialvariationofsnowwatertothepointmeasurementsattheSNOTELsitesare
showninFigure5andFigure6below.Forthesakeofconsistency,thevaluesreportedattheSNOTELsites
areactuallyfromtheSNODASmodel.Tokeepinlinewiththepreviouscorrelations,thedaterangeusedfor
thesecorrelationswasOctober1March31.Theregressionwasperformedusinga2ndorderpolynomial,
exceptfortheSouthCreekwatershed,whichuseda3rddegreepolynomial.Theselinesappearedtoprovide
thebestfittothedataoverthegivenrange.Thecorrelationequationsshouldnotbeconsideredvalid
outsideoftherangeofthegivendataespeciallysincetrendsinpolynomialscanvaryquickly,inconsistent
withnaturallyobservedphenomena.

South Slope SWE Spatial Variation


25

Watershed Mean SWE (in)

20

y = 0.0095x2 + 0.5539x + 0.126


R = 0.936

15

10

y = 0.0052x2 + 0.3501x + 0.1217


R = 0.843

0
0

10

15

20

25

30

Camp Jackson SWE (in)


RecaptureCreek(Gauge)

RecatureCreek

Log.(RecatureCreek)

Poly.(RecatureCreek)

FIGURE 5. SOUTH SLOPE SWE SPATIAL VARIATION C ORRELATION

North Slope SWE Spatial Variation


12

Watershed Mean SWE (in)

10

y = 0.006x2 + 0.8493x + 0.0305


R = 0.9951

8
6
4
2

y = 0.0011x3 0.0355x2 + 0.8922x 0.0689


R = 0.9243

0
0

10

12

Buckboard Flat SWE (in)


SouthCreek

IndianCreek

Poly.(SouthCreek)

Poly.(IndianCreek)

FIGURE 6. NORTH SLOPE SWE SPATIAL VARIATION C ORRELATION


TheresultsfromtheaccumulatedSWEcalculationsaregiveninTable1.Theresultsshownarethe
averageSWEineachwatershedinunitsofmillimeters.
TABLE 1. SNODAS WATERSHED MEAN CUMULATIVE SWE
SNODAS Watershed Mean Cumulative SWE (mm)

South Creek
Recapture Recapture Indian

Creek (ga.)
Creek
Creek
2008
613
239
176
505
2009
398
892
655
478
2010
642
544
399
299
2011
415
802
654
512
2012
393
631
420
304
2013
348
564
416
317
2014
304
539
333
260

Asamplemapshowingthisdataforwateryear2014isshowninFigure7.

FIGURE 7. WATER Y EAR 2014 CUMULATIVE SNOW WATER M AP


Thesedepthsweremultipliedbytheareasoftheirrespectivewatersheds,thendividedbythe
appropriateSNODASSNOTELcorrelationcoefficient(asdescribedpreviously)toproduceatotalwater
volumeavailable.AtableofindividualwatershedareasisshowninTable2andtheavailablesnowwater
volumeisgiveninTable3.
TABLE 2. WATERSHED AREAS

Area (km2)
Area (acres)

South Creek Recapture Creek (ga.) Recapture Creek Indian Creek


142.66
35252

26.83
6629

11.51
2844

6.64
1641


TABLE 3. MODELED WATERSHED AVAILABLE SWE VOLUME

Modeled Watershed Available SWE Volume (acreft)



South Creek
Recapture
Recapture
Indian
Creek (ga.)
Creek
Creek

2008
22,700,000
1,700,000
500,000
900,000
2009
14,700,000
6,200,000
2,000,000
800,000
2010
23,700,000
3,800,000
1,200,000
500,000
2011
15,400,000
5,600,000
2,000,000
900,000
2012
14,500,000
4,400,000
1,300,000
500,000
2013
12,900,000
3,900,000
1,200,000
500,000
2014
11,300,000
3,800,000
1,000,000
400,000
ThestreamgaugereadingsforeachareshowninFigure8.Thedataclearlyshowtheseasonalnatureof
thesestreamflows.

Stream Flow
18
16

Flow Rate (cfs)

14
12
10

RecaptureCreek

SouthCreek

6
4
2
0
Oct07

Oct08

Oct09

Oct10

Oct11

Oct12

Oct13

Oct14

FIGURE 8. STREAM G AUGE READINGS


Thevolumesforthewatershedswithgaugeswereplottedagainstthespringrunoffvolumesgivenfrom
theirrespectivegauges.TheresultsareshowninFigure9andFigure10.

Hundreds

Gauged Runoff Volume (acreft)

Recapture Creek Runoff Correlation


10
9
8
7
6
5
4
3
2
1
0
0

7
Millions

Modeled Watershed Volume (acreft)

FIGURE 9. RECAPTURE CREEK RUNOFF CORRELATION

Thousands

Gauged Runoff Volume (acreft)

South Creek Runoff Correlation


14
12
10
8
6
4
2
0
0

10

15

20

25
Millions

Modeled Watershed Volume (acreft)

FIGURE 10. S OUTH CREEK RUNOFF CORRELATION


Ascanbeseenfromthisdata,thecorrelationisineffectiveinbothcases.ForRecaptureCreek,thespreadis
wideandthereisnoclearcorrelation.ForSouthCreek,thereisastrongcorrelationbetweenthedatapoints,
buttheyaxisinterceptshouldtheoreticallybenearzero,whichitclearlyisnot.Forthesereasons,a
correlationbetweenwatershedvolumeandstreamflowwasnotattempted.

10

Discussion
Themodelcouldnotbecompletedasdesiredascompletedduetoalackofcorrelationbetweenmodeled
watershedavailablevolumeandstreamflow.However,themodelprovidesreasonableaccuracybeforethat
step.Sothemodelmaybeusedtofindanestimateofwatervolumeavailableinthewatersheds.Beforethe
modelisveryuseful,though,acorrelationmustbeestablishedtopredicttherunoffratio.
Thenextmostimportantparametertoconsiderissoilmoisture.SNOTELstationsprovidedsoilmoisture
readingswhichcouldreadilybeincorporatedintotheanalysis.Itisinterestingtonoteastrongcorrelation
betweenwatershedvolumeandrunoffonthenorthside(withlesssolarexposure)butasignificantlyless
correlationonthesouthwheresolarexposureismuchgreater.Assumingsoilmoistureisheavilyinfluenced
bysolarexposure(duetoevaporation),itwouldbeexpectedthatlowerexposercorrelatestomorestable
soilmoistureandthuslessdependenceofonrunoffsoilmoisture.Thisisperhapsevidenceofthecriticalrole
ofsoilmoistureinrunoffforecasting.
ThelackofsoilmoisturedatamayalsoexplaintheissueswiththecorrelationforSouthCreekshownin
Figure10.Thedataseemtoindicatealargeamountofvolumeisneededbeforeanyrunoffispossible.This
differencecouldbeexplainedbyinfiltrationlosses.
Aftersoilmoisture,otherparameterscouldthenbeexplicitlybebuiltintothemodeltoincreaseaccuracy.
Likelycandidatesincludesolarexposure,temperature,preseasonprecipitationandsoilcharacteristics.The
methodofusingcumulativesnowfall,ratherthananotherparametersuchasmaximumsnowfall,shouldalso
bereevaluatedinfutureiterationsofthismodel.
Greateraccuracycouldalsobeachievedbyhavingmoredataavailable,especiallySNOTELdataatBuckboard
Flat.Thisdatawillcomeintime,andsubsequentversionsofthismodelwillbebetterbecauseofit.

Conclusion
Whilethedesiredresultwasnotachieved,someconclusionswereabletobemade.Astrongcorrelationcan
bemadebetweenSNODASmodeleddataandSNOTELmeasuredsnowwaterequivalentintheseregions.A
morerigoroushydrologicmodelwouldallowforacorrelationbetweenwatershedsnowvolumeandstream
flow.Withthatcorrelationmade,thismodelwillbeapowerfultoolforwatermanagersinSanJuanCounty
topredictsnowfallrunofffromtheAbajoMountains.

References
1. NationalWater&ClimateCenter.2013.SNOTELandSnowSurvey&WaterSupplyForecasting.
Portland,OregonUSA.http://www.wcc.nrcs.usda.gov/snotel/SNOTELbrochure.pdf
2. NationalOperationalHydrologicRemoteSensingCenter.2004.SnowDataAssimilationSystem
(SNODAS)DataProductsatNSIDC,1Oct200730Apr2014.Boulder,ColoradoUSA:National
SnowandIceDataCenter.http://dx.doi.org/10.7265/N5TB14TC

11

Appendix ACode Samples


AverageDailySWEinIndividualSheds
print'Importingnecessarymodules'
importarcpy
#fromarcpyimportenv
fromarcpy.saimport*
importos
importsys
importglob
importcsv
#importnumpy
#importmath
#importjson

print'Definingvariables'
sPath=sys.path[0]
dataPath="C:\\Users\\Dane\\Documents\\Fall2014\\CEE
6440_GISWaterResources\\SJWCD\\SNODAS\\WY2008"
scratchPath="C:\\Users\\Dane\\Documents\\Fall2014\\CEE
6440_GISWaterResources\\SJWCD\\SNODAS\\Scratch"
outPath="C:\\Users\\Dane\\Documents\\Fall2014\\CEE6440_GISWaterResources\\SJWCD\\SNODAS\\Output"
geoPath="C:\\Users\\Dane\\Documents\\Fall2014\\CEE6440_GISWaterResources\\SJWCD\\SJC_Water.gdb"

print'Settingupenvironment'
arcpy.env.workspace=dataPath
arcpy.env.scratchWorkspace=scratchPath
SpaceRefRef="C:\\Users\\Dane\\Documents\\Fall2014\\CEE
6440_GISWaterResources\\SJWCD\\SNODAS\\WY2008\\us_ssmv11034tS__T0001TTNATS2007100105HP001.dat.r
eproj.tif"
spatial_ref=arcpy.Describe(SpaceRefRef).spatialReference
arcpy.env.outputCoordinateSystem=spatial_ref
arcpy.env.overwriteOutput=True
arcpy.CheckOutExtension("Spatial")
OutRasPath=outPath

print'Creatinglistofrasterfiles'
#Formethod1
path=os.path.join(dataPath,"*.tif")
RasFiles=[]
forfnameinglob.glob(path):
RasFiles.append(fname)

print'Gatheringfirstrasterinlist'
RemapTab=RemapValue([[9999,0]])
outRas=arcpy.Raster(RasFiles[0])
outRasRec=Reclassify(outRas,"Value",RemapTab)
outRasVal=Con(IsNull(outRasRec),0,outRasRec)

print'DefininglistofmodelSWEvalues'
RecVal=0
JonVal=0

12

#IndVal=0
#SotVal=0
ShedVal=[(RecVal,JonVal)]
#ShedVal=[(RecVal,JonVal,IndVal,SotVal)]

print'Processingrasters'
i=0
foriinrange(0,len(RasFiles)):
print"ProcessingRaster:%d"%(i)

InRas=Raster(RasFiles[i])
InRas1Val=Reclassify(InRas,"Value",RemapTab)
out=Con(IsNull(InRas1Val),0,InRas1Val)

arcpy.CalculateStatistics_management(out,"","","","OVERWRITE",os.path.join(geoPath,"RecaptureWS"))
RecVal=arcpy.GetRasterProperties_management(out,"MEAN")

arcpy.CalculateStatistics_management(out,"","","","OVERWRITE",os.path.join(geoPath,"JohnsonWS"))
JonVal=arcpy.GetRasterProperties_management(out,"MEAN")

#arcpy.CalculateStatistics_management(out,"","","","OVERWRITE",os.path.join(geoPath,"IndianWS"))
#IndVal=arcpy.GetRasterProperties_management(out,"MEAN")
#
#arcpy.CalculateStatistics_management(out,"","","","OVERWRITE",os.path.join(geoPath,"SouthWS"))
#SotVal=arcpy.GetRasterProperties_management(out,"MEAN")

ShedVal.append((RecVal,JonVal))
#ShedVal.append((RecVal,JonVal,IndVal,SotVal))

i=i+1

print'Loopexited'

print'SavinglistofaverageSWEineachwatershed'
withopen('ShedVal08.csv','wb')asf:
writer=csv.writer(f)
writer.writerows(ShedVal)

print'Outputsaved.Gocheckitout.'

CumulativeSeasonalSWEandPointReadings
print'Importingnecessarymodules'
importarcpy
#fromarcpyimportenv
fromarcpy.saimport*
importos
importsys
importglob
importcsv
#importnumpy
#importmath
13

#importjson

print'Definingvariables'
sPath=sys.path[0]
dataPath="C:\\Users\\Dane\\Documents\\Fall2014\\CEE
6440_GISWaterResources\\SJWCD\\SNODAS\\WY2014"
outPath="C:\\Users\\Dane\\Documents\\Fall2014\\CEE
6440_GISWaterResources\\SJWCD\\SNODAS\\Output"
geoPath="C:\\Users\\Dane\\Documents\\Fall2014\\CEE
6440_GISWaterResources\\SJWCD\\SJC_Water.gdb"

print'Settingupenvironment'
arcpy.env.workspace=dataPath
arcpy.env.scratchWorkspace=outPath
SpaceRefRef="C:\\Users\\Dane\\Documents\\Fall2014\\CEE
6440_GISWaterResources\\SJWCD\\SNODAS\\WY2008\\us_ssmv11034tS__T0001TTNATS2007100105HP001
.dat.reproj.tif"
spatial_ref=arcpy.Describe(SpaceRefRef).spatialReference
arcpy.env.outputCoordinateSystem=spatial_ref
arcpy.env.overwriteOutput=True
#arcpy.env.mask="C:\\Users\\Dane\\Documents\\Fall2014\\CEE
6440_GISWaterResources\\SJWCD\\SJC_Water.gdb\\Mask"
arcpy.CheckOutExtension("Spatial")
OutRasPath=outPath

print'Creatinglistofrasterfiles'
#Formethod1
path=os.path.join(dataPath,"*.tif")
RasFiles=[]
forfnameinglob.glob(path):
RasFiles.append(fname)

print'Gatheringfirstrasterinlist'
RemapTab=RemapValue([[9999,0]])
outRas=arcpy.Raster(RasFiles[0])
outRasRec=Reclassify(outRas,"Value",RemapTab)
outRasVal=Con(IsNull(outRasRec),0,outRasRec)

print'DefininglistofmodelSWEvalues'
CJ=arcpy.GetCellValue_management(outRasVal,"109.48336737.816497","1")
BF=arcpy.GetCellValue_management(outRasVal,"109.45001237.866706","1")
SnoVal=[(CJ,BF)]

print'Processingrasters'
foriinrange(1,len(RasFiles)1):
print"ProcessingRaster:%d"%(i)

InRas1=Raster(RasFiles[i1])
InRas2=Raster(RasFiles[i])
InRas1Val=Reclassify(InRas1,"Value",RemapTab)
14

InRas2Val=Reclassify(InRas2,"Value",RemapTab)

out1=Con(IsNull(InRas1Val),0,InRas1Val)
out2=Con(IsNull(InRas2Val),0,InRas2Val)

CumlOut=out2out1
CumlPos=Con(CumlOut>0,1,0)
CumlVal=CumlPos*CumlOut

#CumlVal=Reclassify(Cuml,"Value",RemapTab)
outRasVal=outRasVal+CumlVal
CJ=arcpy.GetCellValue_management(out1,"109.48336737.816497","1")
BF=arcpy.GetCellValue_management(out2,"109.45001237.866706","1")
SnoVal.append((CJ,BF))
i=i+1

print'Loopexited'

print'SavinglistofSWEatSNOTELsites'
withopen('SnoVal14.csv','wb')asf:
writer=csv.writer(f)
writer.writerows(SnoVal)
#forsinSnoVal:
#f.write('%5.5f,%5.5f,%5.5f\n'%(s[0],s[1]))

print'Savingcompleteraster'
outRasVal.save(os.path.join(outPath,'Whole14'))

print'Extractingrastersforeachwatershed'
print'HeregoesRecaputure...'
RecMask=ExtractByMask(outRasVal,os.path.join(geoPath,"RecaptureWS"))
RecMask.save(os.path.join(outPath,"Recapture14"))
print'JohnsonCreek...'
JonMask=ExtractByMask(outRasVal,os.path.join(geoPath,"JohnsonWS"))
JonMask.save(os.path.join(outPath,"Johnson14"))
print'IndianCreek...'
IndMask=ExtractByMask(outRasVal,os.path.join(geoPath,"IndianWS"))
IndMask.save(os.path.join(outPath,"Indian14"))
print'AndfinallySouthCreek.'
SotMask=ExtractByMask(outRasVal,os.path.join(geoPath,"SouthWS"))
SotMask.save(os.path.join(outPath,"South14"))

print'Outputsaved.Gocheckitout.'

15

Das könnte Ihnen auch gefallen