@@ -82,16 +82,7 @@ def expread(resource, asset):
82
82
#
83
83
# ATL03 Photon Cloud Request
84
84
#
85
- def phread (resource , asset ):
86
-
87
- # Build Region Poly
88
- region = [
89
- { "lat" : - 80.75 , "lon" : - 70.00 },
90
- { "lat" : - 81.00 , "lon" : - 70.00 },
91
- { "lat" : - 81.00 , "lon" : - 65.00 },
92
- { "lat" : - 80.75 , "lon" : - 65.00 },
93
- { "lat" : - 80.75 , "lon" : - 70.00 }
94
- ]
85
+ def phread (resource , asset , region ):
95
86
96
87
# Build ATL06 Request
97
88
parms = { "poly" : region ,
@@ -122,33 +113,44 @@ def phread(resource, asset):
122
113
#
123
114
# Plot Actual vs Expected
124
115
#
125
- def plotresults (act , exp , ph ):
116
+ def plotresults (act , exp , ph , region ):
117
+
118
+ # Build Box
119
+ box_lon = [coord ["lon" ] for coord in region ]
120
+ box_lat = [coord ["lat" ] for coord in region ]
121
+
126
122
# Create Plot
127
- fig = plt .figure (num = None , figsize = (12 , 6 ))
123
+ fig = plt .figure (num = None , figsize = (16 , 10 ))
128
124
129
125
# Plot Ground Tracks
130
- ax1 = plt .subplot (131 ,projection = cartopy .crs .PlateCarree ())
126
+ ax1 = plt .subplot (131 ,projection = cartopy .crs .SouthPolarStereo ())
127
+ ax1 .gridlines ()
131
128
ax1 .set_title ("Ground Tracks" )
132
- ax1 .scatter (act .geometry .x , act .geometry .y , s = 1.5 , color = 'r' , zorder = 3 , transform = cartopy .crs .PlateCarree ())
129
+ ax1 .plot (act .geometry .x , act .geometry .y , linewidth = 0.5 , color = 'r' , zorder = 2 , transform = cartopy .crs .Geodetic ())
130
+ ax1 .plot (box_lon , box_lat , linewidth = 1.5 , color = 'b' , zorder = 3 , transform = cartopy .crs .Geodetic ())
133
131
ax1 .add_feature (cartopy .feature .LAND , zorder = 0 , edgecolor = 'black' )
134
132
ax1 .add_feature (cartopy .feature .LAKES )
135
- ax1 .set_extent (( - 180 , 180 , - 90 , 90 ), crs = cartopy . crs . PlateCarree () )
136
- ax1 .gridlines ( xlocs = np . arange ( - 180. , 181. , 60. ), ylocs = np . arange ( - 90. , 91. , 30. ) )
133
+ ax1 .set_xmargin ( 1.0 )
134
+ ax1 .set_ymargin ( 1.0 )
137
135
138
136
# Plot Elevations
139
137
ax2 = plt .subplot (132 )
140
138
ax2 .set_title ("Along Track Elevations" )
141
- gt1r = act [act ["gt" ] == icesat2 .GT1R ]
142
- ax2 .scatter (gt1r ["time" ].values , gt1r ["h_mean" ].values , s = 0.5 , color = 'b' , zorder = 3 )
139
+ act_gt1r = act [act ["gt" ] == icesat2 .GT1R ]
140
+ ax2 .scatter (act_gt1r ["time" ].values , act_gt1r ["h_mean" ].values , s = 0.5 , color = 'b' , zorder = 3 )
143
141
ax2 .scatter (exp ["time" ].values , exp ["h_mean" ].values , s = 1.5 , color = 'g' , zorder = 2 )
144
142
145
143
# Plot Photon Cloud
146
144
ax3 = plt .subplot (133 )
147
145
ax3 .set_title ("Photon Cloud" )
148
- gt1r = ph [ph ["pair" ] == icesat2 .RIGHT_PAIR ]
149
- ax3 .scatter (gt1r .geometry .x , gt1r ["height" ].values , c = gt1r ["info" ], cmap = 'winter_r' , s = 0.1 )
146
+ ph_gt1r = ph [ph ["pair" ] == icesat2 .RIGHT_PAIR ]
147
+ ax3 .scatter (ph_gt1r ["time" ], ph_gt1r ["height" ].values , c = ph_gt1r ["info" ], cmap = 'winter_r' , s = 0.1 )
148
+ act_gt1r = act_gt1r [(act_gt1r .geometry .y > min (box_lat )) & (act_gt1r .geometry .y < max (box_lat ))]
149
+ act_gt1r = act_gt1r [(act_gt1r .geometry .x > min (box_lon )) & (act_gt1r .geometry .x < max (box_lon ))]
150
+ ax3 .scatter (act_gt1r ["time" ], act_gt1r ["h_mean" ].values , color = 'r' , s = 0.5 )
150
151
151
152
# Show Plot
153
+ fig .tight_layout ()
152
154
plt .show ()
153
155
154
156
###############################################################################
@@ -160,7 +162,15 @@ def plotresults(act, exp, ph):
160
162
url = ["127.0.0.1" ]
161
163
atl03_asset = "atlas-local"
162
164
atl06_asset = "atlas-local"
163
- resource = "_20181019065445_03150111_004_01.h5"
165
+ resource = "20181019065445_03150111_004_01"
166
+ photon_cloud_region = [
167
+ { "lat" : - 80.75 , "lon" : - 70.00 },
168
+ { "lat" : - 81.00 , "lon" : - 70.00 },
169
+ { "lat" : - 81.00 , "lon" : - 65.00 },
170
+ { "lat" : - 80.75 , "lon" : - 65.00 },
171
+ { "lat" : - 80.75 , "lon" : - 70.00 }
172
+ ]
173
+
164
174
165
175
# configure logging
166
176
logging .basicConfig (level = logging .INFO )
@@ -184,17 +194,21 @@ def plotresults(act, exp, ph):
184
194
if sys .argv [4 ] == "bypass" :
185
195
url = [url ]
186
196
197
+ # Set Resource #
198
+ if len (sys .argv ) > 5 :
199
+ resource = sys .argv [5 ]
200
+
187
201
# Initialize Icesat2 Package #
188
202
icesat2 .init (url , True )
189
203
190
204
# Execute SlideRule Algorithm
191
- act = algoexec ("ATL03 " + resource , atl03_asset )
205
+ act = algoexec ("ATL03_ " + resource + ".h5" , atl03_asset )
192
206
193
207
# Read ATL06 Expected Results
194
- exp = expread ("ATL06 " + resource , atl06_asset )
208
+ exp = expread ("ATL06_ " + resource + ".h5" , atl06_asset )
195
209
196
210
# Read ATL03 Photon Cloud
197
- ph = phread ("ATL03 " + resource , atl03_asset )
211
+ ph = phread ("ATL03_ " + resource + ".h5" , atl03_asset , photon_cloud_region )
198
212
199
213
# Plot Actual vs. Expected
200
- plotresults (act , exp , ph )
214
+ plotresults (act , exp , ph , photon_cloud_region )
0 commit comments