-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use stdin for search and cleanup for presentation in Essentials
- Loading branch information
1 parent
ca580df
commit 31cf78a
Showing
4 changed files
with
12 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# Read space separated URL from STDIN and download | ||
# -r do not interpret backslashes as an escape | ||
while read -r URL ; do | ||
echo "+++ $URL" | ||
# -m parallel | ||
# -n no-clobber | ||
# -r recursive | ||
# -n no-clobber (do not re-download data) | ||
# -r recursive (download all the data in the specified URL) | ||
gsutil -m cp -n -r "${URL}/" data/ | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
{ | ||
"top": 38.99, | ||
"bottom":38.79, | ||
"left": -92.56, | ||
"right": -92.36, | ||
"lat": 38.899313, | ||
"lon": -92.464562, | ||
"landsat": "LANDSAT_8" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,19 @@ | ||
#!/usr/bin/python3 | ||
import json | ||
import csv | ||
import sys | ||
|
||
DEBUG=False | ||
LIMIT=1000 | ||
|
||
## Example search | ||
# Search for the Burr Oak Tree | ||
# * 38.899313,-92.464562 (Lat north+, Long west-) | ||
# * Landsat: Path 025, Row 033 | ||
|
||
# Example: Burr Oak Tree | ||
# 38.899313,-92.464562 (Lat north+, Long west-) ; Landsat Path 025, Row 033 | ||
config=json.load(open("search.json")) | ||
left=config['left'] | ||
right=config['right'] | ||
top=config['top'] | ||
bottom=config['bottom'] | ||
lat,lon=config['lat'],config['lon'] | ||
landsat=config['landsat'] | ||
|
||
# SCENE_ID,PRODUCT_ID,SPACECRAFT_ID,SENSOR_ID,DATE_ACQUIRED,COLLECTION_NUMBER,COLLECTION_CATEGORY,SENSING_TIME,DATA_TYPE,WRS_PATH,WRS_ROW,CLOUD_COVER,NORTH_LAT,SOUTH_LAT,WEST_LON,EAST_LON,TOTAL_SIZE,BASE_URL | ||
reader=csv.reader(open("data/index.csv")) | ||
header=next(reader) | ||
count=0 | ||
|
||
# Iterate through CSV and print matching product BASE_URL | ||
reader=csv.reader(sys.stdin) | ||
header=next(reader) # skip header | ||
for l in reader: | ||
count+=1 | ||
if DEBUG and count>=LIMIT: | ||
break | ||
|
||
# Extract data | ||
SCENE_ID,PRODUCT_ID,SPACECRAFT_ID,SENSOR_ID,DATE_ACQUIRED,COLLECTION_NUMBER,COLLECTION_CATEGORY,SENSING_TIME,DATA_TYPE,WRS_PATH,WRS_ROW,CLOUD_COVER,NORTH_LAT,SOUTH_LAT,WEST_LON,EAST_LON,TOTAL_SIZE,BASE_URL=l | ||
west,east=float(WEST_LON),float(EAST_LON) | ||
north,south=float(NORTH_LAT),float(SOUTH_LAT) | ||
if DEBUG: print(west,left,east,right,north,top,south,bottom) | ||
|
||
# Test if box is contained-ish by image | ||
if west <= left and east >= right and north >= top and south <= bottom and SPACECRAFT_ID==landsat: | ||
if DEBUG: print(west,left,east,right,north,top,south,bottom,WRS_PATH,WRS_ROW,BASE_URL) | ||
if SPACECRAFT_ID==landsat and north >= lat and south <= lat and west <= lon and east >= lon: | ||
print(BASE_URL) # output BASE_URL |