I am a beginner at python programming, and this is my first post to GeoNet. So here it goes!
I have a huge list of rasters downloaded from the SNODAS website for years 2003 - present (intra-annual range of 11/1-3/31). I have a .tif file for everyday during this period which contains the snow depth data for that day. The metadata for each raster is stored in the tif file's name(e.g., us_ssmv11036tS__T0001TTNATS2013111305HP001.dat.reproj.tif ). However, I am only interested in the date (Nov. 13, 2013 in this case).
My objective is to split this huge list of rasters into winter-years (i.e., rasters from Jan-Mar of a given year belong to the winter-year of the previous calendar year) so that I can pass each winter-year list of rasters through the greaterThanFrequency tool with a simple loop.
Below is a script that works if I download one year of data at a time. I'd appreciate any feedback on how get a list of rasters for each winter-year.
import arcpy from arcpy import env from arcpy.sa import * env.workspace = "E:\DECGIS\snow\NSIDC\projects" \ "\Searchlight\production\data\NSIDC_Data_1021063617170" \ "\Snow_Data_Assimilation_System_(SNODAS)_Data_Products_at_NSIDC" env.overwriteOutput = True arcpy.env.snapRaster = "us_ssmv11036tS__T0001TTNATS2013111305HP001.dat.reproj.tif" arcpy.env.outputCoordinateSystem = "us_ssmv11036tS__T0001TTNATS2013111305HP001.dat.reproj.tif" arcpy.env.nodata = "-9999" inRasters = arcpy.ListRasters("*", "TIF") arcpy.CheckOutExtension("Spatial") #create raster of constant values for greaterThanFrequency tool constantValue = "381" outpath3 = str(env.workspace+"\\threshold4.tif") cellSize = '8.33333333813986E-03' outConstRaster = CreateConstantRaster(constantValue, 'INTEGER', cellSize,"us_ssmv11036tS__T0001TTNATS2013111305HP001.dat.reproj.tif") outConstRaster.save(outpath3) #run greater than frequency analysis inValueRaster = "threshold4.tif" outGTF = GreaterThanFrequency(inValueRaster, inRasters) # Save the output outGTF.save(r"E:\DECGIS\snow\output\2013daysGt15.tif")