-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_crp_expirations_senarios.sh
executable file
·76 lines (59 loc) · 1.96 KB
/
generate_crp_expirations_senarios.sh
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
71
72
73
74
75
76
#!/bin/bash
# expires 2023 : reclass all expired CRP to corn (val=1) and merge with CRP (val=233) and background 2016 NASS (A)
echo " -- ensuring consistent CRS between 2016 & 2023 CRP rasters"
gdalwarp\
-t_srs "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"\
-tr 29.99982 30.00031\
-multi\
-q\
-overwrite\
crp_binary_2023.tif\
b_2023.tif
echo " -- calculating composite CRP raster for 2016 & 2023"
gdal_calc.py -A /gis_data/Landcover/NASS/Raster/2016_crp.tif -B b_2023.tif\
--calc="A+B"\
--outfile="2023_expiring.tif"\
--quiet\
--overwrite
echo " -- ensuring consistent CRS between 2016 NASS & CRP composite"
gdalwarp\
-t_srs "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"\
-tr 29.99982 30.00031\
-multi\
-q\
-overwrite\
/gis_data/Landcover/NASS/Raster/2016_30m_cdls.tif\
b_2016_nass.tif
echo " -- burning CRP expiration into 2016 NASS"
gdal_calc.py -A 2023_expiring.tif\
-B b_2016_nass.tif\
--calc="((A==2)*233) + ((A==1)*1) + ((A==0)*B)"\
--outfile="2023_worst_case_crp_nass.tif"\
--overwrite\
--quiet
echo " -- cleaning up"
rm -rf 2023_expiring.tif
#
# 2027 : reclass all expired CRP to corn (val=1) and merge with CRP (val=233) and background 2016 NASS
#
gdalwarp\
-t_srs "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"\
-tr 29.99982 30.00031\
-multi\
-q\
-overwrite\
crp_binary_2027.tif\
b_2027.tif
gdal_calc.py -A /gis_data/Landcover/NASS/Raster/2016_crp.tif -B b_2023.tif\
-C b_2027.tif\
--calc="A+B+C"\
--outfile="2027_expiring.tif"\
--overwrite
gdal_calc.py -A 2027_expiring.tif\
-B b_2016_nass.tif\
--calc="((A==3)*233) + ((A==1)*1) + ((A==2)*1) + ((A==0)*B)"\
--outfile="2027_worst_case_crp_nass.tif"\
--overwrite\
--quiet
echo " -- cleaning up"
rm -rf 2027_expiring.tif b_2023.tif b_2027.tif b_2016_nass.tif