Skip to content

Commit ddbcbae

Browse files
committed
fix bug in results_suffix; renaming a shapefile.
1 parent 2248b46 commit ddbcbae

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/natcap/invest/recreation/recmodel_client.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -774,9 +774,13 @@ def _retrieve_user_days(
774774
shutil.move(
775775
os.path.join(output_dir, f'{acronym_lookup[dataset]}_monthly_table.csv'),
776776
os.path.join(output_dir, renamed_table))
777-
shutil.move(
778-
os.path.join(output_dir, f'{acronym_lookup[dataset]}_results.shp'),
779-
os.path.join(output_dir, renamed_vector))
777+
driver = gdal.GetDriverByName('ESRI Shapefile')
778+
source_path = os.path.join(
779+
output_dir, f'{acronym_lookup[dataset]}_results.shp')
780+
source = gdal.OpenEx(source_path, gdal.OF_VECTOR)
781+
driver.CreateCopy(
782+
os.path.join(output_dir, renamed_vector), source)
783+
driver.Delete(source_path)
780784

781785
LOGGER.info('connection release')
782786
recmodel_manager._pyroRelease()

tests/test_recreation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ def test_all_metrics_local_server(self):
606606
SAMPLE_DATA, 'predictors_all.csv'),
607607
'scenario_predictor_table_path': os.path.join(
608608
SAMPLE_DATA, 'predictors_all.csv'),
609-
'results_suffix': '',
609+
'results_suffix': 'foo',
610610
'workspace_dir': self.workspace_dir,
611611
'hostname': self.hostname,
612612
'port': self.port,

0 commit comments

Comments
 (0)