-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBatch_Proc.py
228 lines (141 loc) · 8.25 KB
/
Batch_Proc.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#! /usr/bin/env python
import sys
sys.path.insert(0, 'utilities')
sys.dont_write_bytecode = True
import batch_L12
import batch_L23
# To execute, edit the directories and variables below,
# and call this python script from the command line by typing:
#
# python Batch_Proc.py
###############################################################################
# ---> Define the Beginning and Desired Ending Satellite Data
# ---> Processing Levels
###############################################################################
# Beginning Processing Level: '1' for Level-1 files, '2' for Level-2 files
#-----------------------------------------------------------------------------
Input_Level ='2'
# Final Processing Level: '2' for Level-2 files, '3' for Level-3 mapped files
#------------------------------------------------------------------------------
Final_level = '3'
#############################################################################
# ---> Setup the input and output directories and lat/lon bounds
# ---> of mapped output
#############################################################################
# Location of the Level-1 Files:
# -------------------------------------------------------------------------
#
l1a_dir = '/media/guitar79/6TB2/SeaWiFS/SeaWiFS_2003-2006_l2_LAC/2003/l1'
# Location where Level-2 Files will be written when processed from
# Level-1 to Level-2. Or... Location where Level-2 Files were downloaded
# from Ocean Color Web
# -------------------------------------------------------------------------
#
l2_dir = '/media/guitar79/6TB2/SeaWiFS/SeaWiFS_2003-2006_l2_LAC/2003/l2'
# Location where L3map Files and PNG Files will be Written:
# -------------------------------------------------------------------------
#
binmap_dir = '/media/guitar79/6TB2/SeaWiFS/SeaWiFS_2003-2006_l2_LAC/2003/l3'
# Setup Latitude and Longitude for Level-3 file generation
# Note: Latitude-Longitude Order MUST BE: 'south, west, north, east'
# -------------------------------------------------------------------------
#
latlon = '34.00,127.00,44.00,135.00' # Lat/Lon Order is S,W,N,E
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
#############################################################################
# ------------> Optional L1 -> L2 Processing Variables <---------------
#############################################################################
# LEVEL-2 OC PRODUCTS TO BE GENERATED FROM LEVEL-1 RAW DATA VIA L2GEN
# ------------------------------------------------------------------
# The ocean color (and/or sst) list of products to be derived in L1 to L2 via
# l2gen function in seadas is set with the varable: 'prod_list_L12'
#
# Set: prod_list_L12 = 'OC_suite' to produce a standard suite of OC products
# (see batch_l2.py) for current suite. Otherwise set prod_list_L12 to a narrow
# list of specific OC products for example: prod_list_L12 ='chlor_a,pic,poc'
#
# For the case of modis and virrs you also have the option to set sst output
# Options Are: prod_list_L12 = 'sst' or 'none' (future plans will allow sst4)
# -----------------------------
prod_list_L12 = 'chlor_a' # Option is 'OC_suite' or comma separated list of products
#prod_list_L12 = 'chlor_a,pic'
#prod_list_L12_sst= 'sst' # Option is 'sst' or 'none'
# High Resolution Product processing for "MODIS" only" --- OPTIONS: 'on' or 'off'
# ---------------------------
hires = 'off'
# NOTE: ---> Processing hires bands is a 'slow' process if the lat/lon limits
#exceed 3 or 4-deg lat/lon. If you are running modis be sure to extract the
#the L1A files with tight bounds at the time of ordering the data.
#
#For FRS Meris data, extraction of L1B files is not possible. In this case
#use the function:bulk_extract_meris(l1a_dir, extract_dir, extract_latlon)
#that is contained in my_general_utilities.py to first extract the L1B. This
#will make new extracted files (without removing originals).
#l1a_dir= dir of unxtracted files: extract_dir= director to place new extraced
#files: extract_latlon= comma delimed string of tight lat/lon bounds swne
# for example '36.0,-72.0, 38.0,-70.0' Then use extracted files any normal
#Level-1 file for processing...
# Use of Short Wave Infrared --- Options: 'on' or 'off'
# ------------------------------------------------------
swir_onoff = 'off'
# There are about 1 billion different options you can choose to
# alter how l2gen processes your data and all and 99.999% are outside the
# scope of this class, but open a terminal window and type l2gen to see
# all 1 billion options. If some options interest you, then go to
# batch_L12.py and manually add them to: l2gen CALL([...,...,...,]).
#--------------------------------------------------------------------------
###############################################################################
# ------------> Optional L2 -> L3 Processing Variables <---------------
###############################################################################
# l2bin -Spatial Binning Resolution (units are km)
# Options Are: 1,2,4,9,36
#-------------------------------
space_res = '1'
# l3bin -Temporal Binning (Averaging Period) daily, weekly, or monthly
# Options Are: DLY, WKY, or MON
# ------------------------------
#time_period = 'MON'
time_period = 'WKY'
# Binning or Straight Mapping Statistics Output, on or off.
# This tunes on file output of variance and numer of pixel in binning process
# Default is no, options are 'yes' or 'no'
# -----------------------------
stats_yesno = 'yes'
# Force Staraight Map...
# ----------------------------------
straight_map= 'yes' # options are yes or no...
# Quality Flags to be used for color products. #Default is 'standard' as set
# prescibed in the SeaDAS Installation Directory. Otherwise provide your own
# list of named flags to check (a single string of comma separated)
# Same thing goes sst products...
#------------------------------
color_flags = 'standard'
sst_flags = 'standard'
# If you have l2 files with more products than you want to map right now, then
# you can choose to limit which products in the l2 are mapped to Level 3.
# Options are: prod_list_L23 ='all' for all products in the L2 file to be
# mapped or else a specific list of products, for example..
# prod_list_L23 ='all''chlor_a,pic,poc,cdom_index'
# ----------------------------
#prod_list_L23 = 'chlor_a,pic,sst'
prod_list_L23 = 'chlor_a'
# Projection for standard mapped image. 'RECT' only option for now (= CYCL)
# ----------------------------
smi_proj = 'platecarree' #(cylindrical proj. using center lon of region.
###############################################################################
# ---> Don't touch the stuff below...
################################################################################
################################################################################
################################################################################
if Input_Level == '1' and Final_level == '3':
batch_L12.batch_proc_L12(l1a_dir, l2_dir, prod_list_L12, prod_list_L12_sst, swir_onoff, hires)
batch_L23.batch_proc_L23(l2_dir, binmap_dir, prod_list_L23, space_res,time_period, color_flags, sst_flags, latlon, smi_proj, stats_yesno, straight_map)
elif Input_Level =='1' and Final_level == '2':
#batch_L12.batch_proc_L12(l1a_dir, l2_dir, prod_list_L12, prod_list_L12_sst, NO2_onoff, swir_onoff, hires)
batch_L12.batch_proc_L12(l1a_dir, l2_dir, prod_list_L12, prod_list_L12_sst, swir_onoff, hires)
elif Input_Level == '2' and Final_level == '3':
batch_L23.batch_proc_L23(l2_dir, binmap_dir, prod_list_L23, space_res,time_period, color_flags, sst_flags, latlon, smi_proj, stats_yesno, straight_map)
else:
print ('##### Please specify different input and output levels #####' )
sys.exit()