The problem:
UnboundLocalError: local variable 'dataspace_change_products_all' referenced before assignment
The cause:
query_dataspace_by_polygon was returning blank if no products matched the query (rightfully so), this meant that the line response_dataframe = pd.DataFrame.from_records(response_dataframe["properties"]) could not succeed and so dataspace_change_products_all could not be created.
The double-checking:
CDSE API returned a Status Code of 200, meaning that the API was responding as expected.
The search query was for a short time period (start_date=20230331 and end_date=20230412) and a low cloud_cover threshold of 25%, therefore no images matched these requirements.
The solution:
added a check that if no products are in response_dataframe, then print a verbose error to the log and sys.exit(1).
The problem:
UnboundLocalError: local variable 'dataspace_change_products_all' referenced before assignment
The cause:
query_dataspace_by_polygon
was returning blank if no products matched the query (rightfully so), this meant that the lineresponse_dataframe = pd.DataFrame.from_records(response_dataframe["properties"])
could not succeed and sodataspace_change_products_all
could not be created.The double-checking:
200
, meaning that the API was responding as expected.start_date=20230331
andend_date=20230412
) and a lowcloud_cover
threshold of 25%, therefore no images matched these requirements.The solution: added a check that if no products are in
response_dataframe
, then print a verbose error to the log andsys.exit(1)
.