-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from noaa-ocs-modeling/bugfix/wintemp
Fixing Permission Issues on Windows Related to Tempfiles
- Loading branch information
Showing
12 changed files
with
165 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ dependencies: | |
- pytz | ||
- colored-traceback | ||
- typing-extensions | ||
- jigsawpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
import os | ||
os.system(""" | ||
ls /tmp/test_dem.tif > /dev/null | ||
if [ $? -eq 0 ]; then exit; fi | ||
wget https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/northeast_sandy/ncei19_n40x75_w073x75_2015v1.tif -O /tmp/fullsize_dem.tif | ||
gdalwarp -tr 0.0005 0.0005 -r average -overwrite /tmp/fullsize_dem.tif /tmp/test_dem.tif | ||
""") | ||
import tempfile | ||
import urllib.request | ||
from pathlib import Path | ||
|
||
from rasterio.enums import Resampling | ||
|
||
from ocsmesh.raster import Raster | ||
|
||
|
||
# Find a better way! | ||
tif_url = ( | ||
'https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/northeast_sandy/ncei19_n40x75_w073x75_2015v1.tif' | ||
) | ||
TEST_FILE = os.path.join(tempfile.gettempdir(), 'test_dem.tif') | ||
if not Path(TEST_FILE).exists(): | ||
tmpfd, tmppath = tempfile.mkstemp() | ||
urllib.request.urlretrieve(tif_url, filename=tmppath) | ||
os.close(tmpfd) | ||
r = Raster(tmppath) | ||
r.resampling_method = Resampling.average | ||
r.resample(scaling_factor=0.01) | ||
r.save(TEST_FILE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.