Skip to content

Commit

Permalink
fix SRTM download
Browse files Browse the repository at this point in the history
  • Loading branch information
BuddyVolly committed Sep 21, 2021
1 parent 5c6896b commit c289e5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions ost/Project.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# ------ bug of rasterio --------
import os

if "GDAL_DATA" in list(os.environ.keys()):
del os.environ["GDAL_DATA"]
if "PROJ_LIB" in list(os.environ.keys()):
Expand Down Expand Up @@ -69,7 +70,7 @@ def __init__(
logger.info('Project directory already exists. '
'No data has been deleted at this point but '
'make sure you really want to use this folder.')

# define project sub-directories if not set, and create folders
self.download_dir = self.project_dir.joinpath('download')
self.download_dir.mkdir(parents=True, exist_ok=True)
Expand Down Expand Up @@ -617,7 +618,6 @@ def pre_download_srtm(self):
logger.info('Pre-downloading SRTM tiles')
srtm.download_srtm(self.aoi)


def bursts_to_ards(
self,
timeseries=False,
Expand Down Expand Up @@ -712,13 +712,13 @@ def bursts_to_ards(
if overwrite:
logger.info('Deleting processing folder to start from scratch')
h.remove_folder_content(self.config_dict['processing_dir'])

# --------------------------------------------
# 5 set resolution to degree
# self.ard_parameters['resolution'] = h.resolution_in_degree(
# self.center_lat, self.ard_parameters['resolution'])

if self.config_dict['max_workers'] > 1:
if self.config_dict['max_workers'] > 1 and self.ard_parameters['single_ARD']['dem']['dem_name'] == 'SRTM 1Sec HGT':
self.pre_download_srtm()

# --------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions ost/helpers/srtm.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ def download_srtm(aoi):
warnings.filterwarnings(
'ignore', 'Geometry is in a geographic CRS', UserWarning
)
srtm = gpd.read_file(
OST_ROOT.joinpath('aux/srtm1sectiles.gpkg')
)

srtm = gpd.read_file(OST_ROOT.joinpath('aux/srtm1sectiles.gpkg'))

aoi_gdf = vec.wkt_to_gdf(aoi)
aoi_gdf['geometry'] = aoi_gdf.geometry.buffer(1)
overlap_df = gpd.overlay(srtm, aoi_gdf, how='intersection')

iter_list = []
for file in overlap_df.url.values:
iter_list.append(file)
Expand Down

0 comments on commit c289e5c

Please sign in to comment.