Skip to content

Commit

Permalink
add basic error check for existence of raster file
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolepaul committed May 17, 2021
1 parent dac467e commit 75f3d0e
Show file tree
Hide file tree
Showing 9 changed files with 126,816 additions and 0 deletions.
126,810 changes: 126,810 additions & 0 deletions data/exposure_in/Exposure_Res_Portugal.csv

Large diffs are not rendered by default.

Binary file added data/shapefile_in/Adm3_Portugal.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/shapefile_in/Adm3_Portugal.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
1 change: 1 addition & 0 deletions data/shapefile_in/Adm3_Portugal.qpj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file added data/shapefile_in/Adm3_Portugal.shp
Binary file not shown.
Binary file added data/shapefile_in/Adm3_Portugal.shx
Binary file not shown.
Binary file added data/worldpop/prt_ppp_2020.tif
Binary file not shown.
Binary file added data/worldpop/resampled_prt_ppp_2020.tif
Binary file not shown.
4 changes: 4 additions & 0 deletions util/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ def resample_raster_to_resolution(original_raster, file_name, res,
sample_agg. At the time of creation, there was no SUM option and so
the AVERAGE option was used'''

# Confirm raster file exists
if not os.path.exists(original_raster):
print_red(f"ERROR: You need to download raster data first, could not find {original_raster}.")

# Arrange new file name
new_raster = original_raster.replace(file_name, "resampled_" + file_name)

Expand Down

0 comments on commit 75f3d0e

Please sign in to comment.