From 5d4157853345dff64ac3904accf0dae0fa2b63a5 Mon Sep 17 00:00:00 2001 From: Zach Keskinen Date: Thu, 5 May 2022 09:34:18 -0600 Subject: [PATCH 1/2] collection work --- uavsar_pytools/uavsar_collection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uavsar_pytools/uavsar_collection.py b/uavsar_pytools/uavsar_collection.py index 5c5ad22..972bb87 100644 --- a/uavsar_pytools/uavsar_collection.py +++ b/uavsar_pytools/uavsar_collection.py @@ -51,8 +51,8 @@ def __init__(self, collection, work_dir, overwrite = False, clean = True, debug self.dates = dates if dates: # define search parameters for sierra flight line - self.start_date = dates[0] - self.end_date = dates[1] + self.start_date = pd.to_datetime(dates[0]) + self.end_date = pd.to_datetime(dates[1]) def find_urls(self): # search for data From c22b69fe638887b80fcc97d266b12aa0b7d1ef9a Mon Sep 17 00:00:00 2001 From: Zach Keskinen Date: Thu, 5 May 2022 09:36:32 -0600 Subject: [PATCH 2/2] git ignore and pip update --- .gitignore | 17 ++++++++++++++++- build/lib/uavsar_pytools/__init__.py | 2 +- build/lib/uavsar_pytools/download/download.py | 2 +- setup.py | 2 +- uavsar_pytools.egg-info/PKG-INFO | 17 +++++++++++++++-- uavsar_pytools/__init__.py | 2 +- 6 files changed, 35 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 636c09a..6dbe035 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,19 @@ test.ipynb uavsar_pytools.egg-info/ build/* dist/* -uavsar_pytools.egg-info/ \ No newline at end of file +uavsar_pytools.egg-info/ + +# Distribution / packaging +bin/ +build/ +develop-eggs/ +dist/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg \ No newline at end of file diff --git a/build/lib/uavsar_pytools/__init__.py b/build/lib/uavsar_pytools/__init__.py index cdef330..694f915 100644 --- a/build/lib/uavsar_pytools/__init__.py +++ b/build/lib/uavsar_pytools/__init__.py @@ -5,4 +5,4 @@ # Version of the package -__version__ = "0.4.8" \ No newline at end of file +__version__ = "0.4.9" \ No newline at end of file diff --git a/build/lib/uavsar_pytools/download/download.py b/build/lib/uavsar_pytools/download/download.py index 0e15482..e8e76ea 100644 --- a/build/lib/uavsar_pytools/download/download.py +++ b/build/lib/uavsar_pytools/download/download.py @@ -37,7 +37,7 @@ def stream_download(url, output_f): pbar.update(len(ch)) else: if r.status_code == 401: - log.warning(f'HTTP CODE 401. DOWNLOADING REQUIRES A NETRC FILE AND SIGNED UAVSAR END USER AGREEMENT!ß See ReadMe for instructions.') + log.warning(f'HTTP CODE 401. DOWNLOADING REQUIRES A NETRC FILE AND SIGNED UAVSAR END USER AGREEMENT! See ReadMe for instructions.') elif r.status_code == 404: log.warning(f'HTTP CODE 404. Url not found. Currently trying {url}.') else: diff --git a/setup.py b/setup.py index 3360105..703fc03 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ EMAIL = 'zachkeskinen@gmail.com' AUTHOR = 'Zach Keskinen and Jack Tarricone' REQUIRES_PYTHON = '>=3.7.0' -VERSION = '0.4.8' +VERSION = '0.4.9' # What packages are required for this module to be executed? REQUIRED = [ diff --git a/uavsar_pytools.egg-info/PKG-INFO b/uavsar_pytools.egg-info/PKG-INFO index 390bafb..b955a07 100644 --- a/uavsar_pytools.egg-info/PKG-INFO +++ b/uavsar_pytools.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: uavsar-pytools -Version: 0.4.8 +Version: 0.4.9 Summary: Tools to download and convert ground projected UAVSAR images. Home-page: https://github.com/SnowEx/uavsar_pytools Author: Zach Keskinen and Jack Tarricone @@ -35,7 +35,7 @@ pip install uavsar_pytools You will need a [.netrc file](https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html) in your home directory. This is a special file that stores passwords and usernames to be accessed by programs. If you are already registered at either the alaska satellite facility or jet propulsion laboratory skip step 1. Otherwise: -1. If you need a username and password register at [link](https://search.asf.alaska.edu/). Please ensure you have signed the end user agreement for Uavsar. +1. If you need a username and password register at [link](https://search.asf.alaska.edu/). Please ensure you have signed the end user agreement for Uavsar. You may need to attempt to download a uavsar image from vertex to prompt the end user agreement. 2. In a python terminal or notebook enter: ```python @@ -73,6 +73,19 @@ scene.images[0]['array'] # get the first image numpy array for analysis For quick checks to visualize the data there is also a convenience method `scene.show(i = 1)` that allows you to quickly visualize the first image, or by iterating on i = 2,3,4, etc all the images in the zip file. This method is only available after converting binary images to array with `scene.url_to_tiffs()`. +## Downloading whole collections + +Uavsar_pytools can now take a collection name and a start and end date and find, download, and process an entire collection of uavsar images. Collection names can be found at [campaign list](https://api.daac.asf.alaska.edu/services/utils/mission_list). Once you know your campaign name and the date range you can give the package a working directory along with the name and dates and it will do the rest. For example if you want to download all uavsar images for Grand Mesa, Colorado from November 2019 to April 2020 and wanted to save it to your documents folder you would use: + +```python +from uavsar_pytools import UavsarCollection +collection = UavsarCollection(collection = 'Grand Mesa, CO', work_dir = '~/Documents/collection_ex/', dates = ('2019-11-01','2020-04-01')) +# to keep binary files use `clean = False`, to download incidence angles with each image use `inc = True`, for only certain pols use `pols = ['VV','HV']` +collection.collection_to_tiffs() +``` + +Each image pair found will be placed in its own directory with its Alaska Satellite Facility derived name as the directory name. Unlike for UavsarScene this functionality will automatically delete the downloaded binary and zip files after converting them to tiffs to save space. + ## Finding URLs for your images The provided jupyter notebook tutorial in the notebooks folder will walk you through generating a bounding box for your area of interest and finding urls through the [asf_search api](https://github.com/asfadmin/Discovery-asf_search). However if you can also use the [vertex website](https://search.asf.alaska.edu/). After drawing a box and selecting UAVSAR from the platform selection pane (circled in red below) you will get a list of search results. Click on the ground projected image you want to download and right click on the download link (circled in orange below). Select ```copy link``` and you will have copied your relevant zip url. diff --git a/uavsar_pytools/__init__.py b/uavsar_pytools/__init__.py index cdef330..694f915 100644 --- a/uavsar_pytools/__init__.py +++ b/uavsar_pytools/__init__.py @@ -5,4 +5,4 @@ # Version of the package -__version__ = "0.4.8" \ No newline at end of file +__version__ = "0.4.9" \ No newline at end of file