-
Notifications
You must be signed in to change notification settings - Fork 0
/
ASCAT_rasters.py
70 lines (33 loc) · 1.49 KB
/
ASCAT_rasters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 30 00:35:32 2017
@author: kkrao
"""
"""
shift raster
project raster
clip raster
build attr table
"""
from dirs import *
arcpy.env.overwriteOutput=True
year_range=range(2009,2017)
day_range=range(1,362,2)
shiftby=1150*4450
dir=MyDir+'/ASCAT/sigma-0/'
for k in year_range:
year = '%s' %k #Type the year
print('Processing data for year '+year+' ...')
arcpy.env.workspace=dir+year
os.chdir(dir+year)
for j in day_range:
day='%03d'%j
inRaster='sigma0_'+year+day+'.tif'
if os.path.isfile(inRaster):
arcpy.Shift_management(inRaster, 's_'+inRaster, "0","%s"%shiftby)
inRaster='s_'+inRaster
arcpy.ProjectRaster_management(inRaster, 'p_'+inRaster, 4326) ## project
inRaster='p_'+inRaster
arcpy.Clip_management(inRaster,'#','cl_'+inRaster,Dir_CA+'/'+"CA.shp", "0", "ClippingGeometry")
inRaster='cl_'+inRaster
arcpy.BuildRasterAttributeTable_management(inRaster, "Overwrite")