############################################################################### # MAIN ############################################################################### if __name__ == '__main__': url = ["127.0.0.1"] asset = "atlas-local" max_workers = 0 logging.basicConfig(level=logging.INFO) # Region of Interest # region_filename = sys.argv[1] regions = icesat2.toregion(region_filename) if (len(regions) > 1): print( "Warning - {} regions detected, only first region supplied will be processed" .format(len(regions))) elif (len(regions) < 1): print("Error - no valid regions supplied") exit() region = regions[0] # Set URL # if len(sys.argv) > 2: url = sys.argv[2] asset = "atlas-s3" # unlikely to use local if overriding url # Set Asset #
def test_toregion(self): region = icesat2.toregion(os.path.join(TESTDIR, 'data/polygon.geojson')) assert len(region) == 1 # single polygon bbox assert len(region[0]) == 5 # 5 coordinate pairs assert {'lon', 'lat'} <= region[0][0].keys()
icfg["spatial_extent"], icfg["date_range"], cycles=icfg["cycles"], tracks=icfg["tracks"]) # visualize icepx region # iregion.visualize_spatial_extent() # display summary information iregion.product_summary_info() # print("Available Granules:", iregion.avail_granules()) # print("Available Granule IDs:", iregion.avail_granules(ids=True)) # initialize sliderule api icesat2.init(scfg["url"], verbose=True) # generate sliderule atl06 elevations parms["poly"] = icesat2.toregion(icfg["spatial_extent"])[0] atl06_sr = ipxapi.atl06p(iregion, parms, scfg["asset"]) # Create Plot f, ax = plt.subplots() vmin, vmax = atl06_sr['h_mean'].quantile((0.02, 0.98)) atl06_sr.plot(ax=ax, column='h_mean', cmap='inferno', s=0.1, vmin=vmin, vmax=vmax) plt.show()
def test_toregion_empty_raises(self): with pytest.raises(TypeError, match=('filename')): region = icesat2.toregion()
############################################################################### # MAIN ############################################################################### if __name__ == '__main__': # Set Filename filename = sys.argv[1] # Override Tolerance tolerance = 0.0 if len(sys.argv) > 2: tolerance = float(sys.argv[2]) # Override dataset dataset = 'ATL03' if len(sys.argv) > 3: dataset = sys.argv[3] # Override region of interest regions = icesat2.toregion(filename, tolerance) # Query CMR for list of resources for i in range(len(regions)): region = regions[i] resources = icesat2.cmr(region, short_name=dataset) print("Region {}: {} points, {} files".format(i, len(region), len(resources))) for resource in resources: print(resource)