dinosar.archive.asf package¶
Functions for querying ASF archive.
This module has utilities for interacting with the Alaska Satellite Facility NASA Distributed Active Archive Center (ASF DAAC).
-
dinosar.archive.asf.
download_scene
(downloadUrl)¶ Download a granule from ASF.
Launches an external wget command to download a single granule from ASF. Note that if stored on S3, in us-east-1 region.
- Parameters
downloadUrl (str) – A valid download URL for an ASF granule.
-
dinosar.archive.asf.
get_orbit_url
(granuleName, url='https://s1qc.asf.alaska.edu/aux_poeorb')¶ Retrieve precise orbit file for a specific Sentinel-1 granule.
Precise orbits available ~3 weeks after aquisition.
- Parameters
granuleName (str) – ASF granule name, e.g.: S1B_IW_SLC__1SDV_20171117T015310_20171117T015337_008315_00EB6C_40CA
url (str) – website with simple list of orbit file links
- Returns
orbitUrl – url pointing to matched orbit file
- Return type
str
-
dinosar.archive.asf.
get_orbit_url_file
(granuleName, inventory='poeorb.txt', url='https://s1qc.asf.alaska.edu/aux_poeorb')¶ Find and construct orbit URL from directory listing.
-
dinosar.archive.asf.
get_slc_names
(gf, dateStr, relativeOrbit)¶ return just filenames rather than urls
-
dinosar.archive.asf.
get_slc_urls
(gf, dateStr, relativeOrbit)¶ Get S1 frame downloadUrls for a given date and relative orbit.
- Parameters
gf (GeoDataFrame) – ASF inventory of S1 frames
datStr (str) – date in string format (e.g. ‘2018/11/30’)
relativeOrbit (str) – relative orbit in string format (e.g. ‘136’)
- Returns
filenames – list of matching download url strings
- Return type
list
-
dinosar.archive.asf.
inventory2s3
(gf, s3bucket)¶ Mirror Sentinel1 inventory for specific path on S3.
Assumes geodataframe has already been filtered for desired frames.
-
dinosar.archive.asf.
load_asf_json
(jsonfile)¶ Convert JSON metadata from ASF query to dataframe.
JSON metadata returned from ASF DAAC API is loaded into a geopandas GeoDataFrame, with timestamps converted to datatime objects.
- Parameters
jsonfile (str) – Path to the json file from an ASF API query.
- Returns
gf – A geopandas GeoDataFrame
- Return type
GeoDataFrame
-
dinosar.archive.asf.
load_inventory
(inventoryJSON)¶ Load inventory saved with asf.archive.save_inventory().
- Parameters
inventoryJSON (str) – dinsar inventory file (query.geojson)
- Returns
gf – A geopandas GeoDataFrame
- Return type
GeoDataFrame
-
dinosar.archive.asf.
merge_inventories
(s1Afile, s1Bfile)¶ Merge Sentinel 1A and Sentinel 1B into single dataframe.
ASF API queries are done per satellite, so queries for S1A and S1B need to be merged into a single dataframe.
- Parameters
s1Afile (str) – Path to the json file from an ASF API query for Sentinel-1A data.
s1Bfile (str) – Path to the json file from an ASF API query for Sentinel-1B data.
- Returns
gf – A geopandas GeoDataFrame
- Return type
GeoDataFrame
-
dinosar.archive.asf.
ogr2snwe
(vectorFile, buffer=None)¶ Convert ogr shape to South,North,West,East bounds.
- Parameters
vectorFile (str) – path to OGR-recognized vector file.
buffer (float) – Amount of buffer distance to add to shape (in decimal degrees).
- Returns
snwe – a list of coorinate bounds [S, N, W, E]
- Return type
list
-
dinosar.archive.asf.
query_asf
(snwe, sat='SA', format='json', orbit=None, start=None, stop=None, beam='IW', flightDirection=None)¶ Search ASF with [south, north, west, east] bounds.
Saves result to local file: query_{sat}.{format}
- Parameters
snwe (list) – bounding coordinates [south, north, west, east].
sat (str) – satellite id (either ‘S1A’ or ‘S1B’)
format (str) – output format of ASF API (json, csv, kml, metalink)
Notes
API keywords = [absoluteOrbit,asfframe,maxBaselinePerp,minBaselinePerp, beamMode,beamSwath,collectionName,maxDoppler,minDoppler,maxFaradayRotation, minFaradayRotation,flightDirection,flightLine,frame,granule_list, maxInsarStackSize,minInsarStackSize,intersectsWith,lookDirection, offNadirAngle,output,platform,polarization,polygon,processingLevel, relativeOrbit,maxResults,processingDate,start or end acquisition time, slaveStart/slaveEnd
-
dinosar.archive.asf.
run_bash_command
(cmd)¶ Call a system command through the subprocess python module.
-
dinosar.archive.asf.
save_geojson_footprints
(gf)¶ Save all frames from each date as separate geojson file.
JSON footprints with metadata are easily visualized if pushed to GitHub. This saves a bunch of [date].geojson files in local directory.
- Parameters
gf (GeoDataFrame) – a pandas geodataframe from load_asf_json
-
dinosar.archive.asf.
save_inventory
(gf, outname='query.geojson', format='GeoJSON')¶ Save inventory GeoDataFrame as a GeoJSON file.
- Parameters
gf (GeoDataFrame) – a pandas geodataframe from load_asf_json.
outname (str) – name of output file.
format (str) – OGR-recognized output format.
-
dinosar.archive.asf.
snwe2file
(snwe)¶ Use Shapely to convert to GeoJSON & WKT.
Save local text files in variety of formats to record bounds: snwe.json, snwe.wkt, snwe.txt.
- Parameters
snwe (list) – bounding coordinates [south, north, west, east].
-
dinosar.archive.asf.
summarize_inventory
(gf)¶ Get basic statistics for each track.
For each relativeOrbit in the dataframe, return the first date, last date, number of dates, number of total frames, flight direction (ascending, or descending), and UTC observation time. Also calculates approximate archive size by assuming 5Gb * total frames. Prints results to screen and also saves inventory_summary.csv.
- Parameters
gf (GeoDataFrame) – a pandas geodataframe from load_asf_json
-
dinosar.archive.asf.
summarize_orbits
(gf)¶ Break inventory into separate dataframes by relative orbit.
For each relative orbit in GeoDataFame, save simple summary of acquisition dates to acquisitions_[orbit].csv.
- Parameters
gf (GeoDataFrame) – a pandas geodataframe from load_asf_json
-
dinosar.archive.asf.
write_download_urls
(fileList)¶ Write list of frame urls to a file.
This is useful if you are running isce on a server and want to keep a record of download links. Writes download-links.txt to current folder.
- Parameters
fileList (list) – list of download url strings