Skip to content

Commit 0ce40a8

Browse files
committed
updated algorithm test to accept only one asset specifier
1 parent 7a84116 commit 0ce40a8

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

tests/algorithm.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ def plotresults(act, exp, ph, region):
148148
ax3 = plt.subplot(133)
149149
ax3.set_title("Photon Cloud")
150150
ph_gt1r = ph[ph["pair"] == icesat2.RIGHT_PAIR]
151-
colormap = np.array(['c','b','g','g','y'])
152-
ax3.scatter(ph_gt1r["time"], ph_gt1r["height"].values, c=colormap[ph_gt1r["info"]], s=0.2)
151+
colormap = np.array(['c','b','g','g','y']) # noise, ground, canopy, top of canopy, unclassified
152+
ax3.scatter(ph_gt1r["time"], ph_gt1r["height"].values, c=colormap[ph_gt1r["info"]], s=1.5)
153153
act_gt1r = act_gt1r[(act_gt1r.geometry.y > min(box_lat)) & (act_gt1r.geometry.y < max(box_lat))]
154154
act_gt1r = act_gt1r[(act_gt1r.geometry.x > min(box_lon)) & (act_gt1r.geometry.x < max(box_lon))]
155155
ax3.scatter(act_gt1r["time"], act_gt1r["h_mean"].values, color='r', s=0.5)
@@ -165,8 +165,7 @@ def plotresults(act, exp, ph, region):
165165
if __name__ == '__main__':
166166

167167
url = ["127.0.0.1"]
168-
atl03_asset = "atlas-local"
169-
atl06_asset = "atlas-local"
168+
asset = "atlas-local"
170169
resource = "20181019065445_03150111_004_01"
171170
photon_cloud_region = [
172171
{ "lat": -80.75, "lon": -70.00 },
@@ -176,44 +175,38 @@ def plotresults(act, exp, ph, region):
176175
{ "lat": -80.75, "lon": -70.00 }
177176
]
178177

179-
180178
# configure logging
181179
logging.basicConfig(level=logging.INFO)
182180

183181
# Set URL #
184182
if len(sys.argv) > 1:
185183
url = sys.argv[1]
186-
atl03_asset = "atlas-s3"
187-
atl06_asset = "atlas-s3"
184+
asset = "atlas-s3"
188185

189-
# Set ATL03 Asset #
186+
# Set Asset #
190187
if len(sys.argv) > 2:
191-
atl03_asset = sys.argv[2]
192-
193-
# Set ATL06 Asset #
194-
if len(sys.argv) > 3:
195-
atl06_asset = sys.argv[3]
188+
asset = sys.argv[2]
196189

197190
# Bypass service discovery if url supplied
198-
if len(sys.argv) > 4:
199-
if sys.argv[4] == "bypass":
191+
if len(sys.argv) > 3:
192+
if sys.argv[3] == "bypass":
200193
url = [url]
201194

202195
# Set Resource #
203-
if len(sys.argv) > 5:
204-
resource = sys.argv[5]
196+
if len(sys.argv) > 4:
197+
resource = sys.argv[4]
205198

206199
# Initialize Icesat2 Package #
207200
icesat2.init(url, True)
208201

209202
# Execute SlideRule Algorithm
210-
act = algoexec("ATL03_"+resource+".h5", atl03_asset)
203+
act = algoexec("ATL03_"+resource+".h5", asset)
211204

212205
# Read ATL06 Expected Results
213-
exp = expread("ATL06_"+resource+".h5", atl06_asset)
206+
exp = expread("ATL06_"+resource+".h5", asset)
214207

215208
# Read ATL03 Photon Cloud
216-
ph = phread("ATL03_"+resource+".h5", atl03_asset, photon_cloud_region)
209+
ph = phread("ATL03_"+resource+".h5", asset, photon_cloud_region)
217210

218211
# Plot Actual vs. Expected
219212
plotresults(act, exp, ph, photon_cloud_region)

0 commit comments

Comments
 (0)