GeoscienceAustralia / agdc

Repository for Australian Geoscience Data Cube (AGDC) code
BSD 3-Clause "New" or "Revised" License
29 stars 24 forks source link

Retrieve Dataset Stack API fails #82

Closed didierearith closed 9 years ago

didierearith commented 9 years ago

The Retrieve Dataset Stack API fails in the 'go' function of the retrieve_dataset_stack.py file.

An exception is raised, because there is a 'del raster' instruction in the loop. Here are the logs:

2015-08-05 10:08:10,261 INFO acq = 1980-01-01 to 2020-12-31 satellites = LS7 LS8 PQA mask = WOFS mask =

2015-08-05 10:08:10,261 INFO x = 114 y = -027 VECTOR mask =

2015-08-05 10:08:10,261 INFO datasets to retrieve = ARG25 bands to retrieve = ['BLUE', 'GREEN', 'RED', 'NEAR_INFRARED', 'SHORT_WAVE_INFRARED_1', 'SHORT_WAVE_INFRARED_2', 'COASTAL_AEROSOL'] output directory = /home/adminprod/data1/tmp/ over write existing = True list only = False output format = GEOTIFF

2015-08-05 10:08:10,284 INFO Total tiles found [3] 2015-08-05 10:08:10,284 INFO Creating stack for band [BLUE] 2015-08-05 10:08:10,285 INFO Total tiles for band [BLUE] is [3] 2015-08-05 10:08:10,301 INFO Stacking [BLUE] band data from [/home/adminprod/data1/rs0/tiles/EPSG4326_1deg_0.00025pixel/LS8_OLITIRS/114-027/2015/LS8_OLI_TIRS_NBAR114-027_2015-04-08T02-21-35.121356.tif] with PQA [] and PQA mask [] and WOFS [] and WOFS mask [] to [/home/adminprod/data1/tmp/LS8_OLI_TIRS_NBAR_STACK_BLUE114-027_2015-04-08T02-21-35.121356.tif] 2015-08-05 10:08:22,015 INFO Stacking [BLUE] band data from [/home/adminprod/data1/rs0/tiles/EPSG4326_1deg_0.00025pixel/LS7ETM/114-027/2015/mosaic_cache/LS7_ETM_NBAR114-027_2015-04-16T02-21-25.835779.vrt] with PQA [] and PQA mask [] and WOFS [] and WOFS mask [] to [/home/adminprod/data1/tmp/LS7_ETM_NBAR_STACK_BLUE114-027_2015-04-16T02-21-25.835779.tif] 2015-08-05 10:08:33,762 INFO Stacking [BLUE] band data from [/home/adminprod/data1/rs0/tiles/EPSG4326_1deg_0.00025pixel/LS8_OLITIRS/114-027/2015/LS8_OLI_TIRS_NBAR114-027_2015-04-24T02-21-32.718800.tif] with PQA [] and PQA mask [] and WOFS [] and WOFS mask [] to [/home/adminprod/data1/tmp/LS8_OLI_TIRS_NBAR_STACK_BLUE114-027_2015-04-24T02-21-32.718800.tif] 2015-08-05 10:08:44,049 INFO Creating stack for band [GREEN] 2015-08-05 10:08:44,049 INFO Total tiles for band [GREEN] is [3] Traceback (most recent call last): File "/home/adminprod/agdc-develop/api/source/main/python/datacube/api/tool/retrieve_dataset_stack.py", line 339, in RetrieveDatasetStackTool("Retrieve Dataset Stack").run() File "/home/adminprod/agdc-develop/api/source/main/python/datacube/api/tool/init.py", line 165, in run self.go() File "/home/adminprod/agdc-develop/api/source/main/python/datacube/api/tool/retrieve_dataset_stack.py", line 267, in go if not raster: UnboundLocalError: local variable 'raster' referenced before assignment

My command line parameters are: --satellite LS7 LS8 --x 114 --y -27 --dataset-type ARG25 --output-directory=/home/adminprod/data1/tmp/ --overwrite --dataset-type ARG25 --verbose

To be able to run the API successfully, I applied the following changes (but I'm not sure this is the best and more efficient solution): moved the 'raster' declaration in the loop ' enumerate(relevant_tiles, start=1)' (from line 195 to line 222):

... 195 driver = None ...

220 for index, tile in enumerate(relevant_tiles, start=1): 221
222 raster = None
...

simonoldfield commented 9 years ago

I actually fixed this in the sjo/develop branch. I'm currently working my way through the command line tools and workflows and making sure they are all up-to-date with recent changes in the core API code. Once that is done I will merge back into the develop branch. Hopefully within the next day or two - other priorities dependent!

simonoldfield commented 9 years ago

Updated code merged into develop branch