Skip to content

Commit

Permalink
bumpy adcircpy version and remove wget dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Apr 22, 2022
1 parent 379b111 commit a97e5ec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 50 deletions.
47 changes: 0 additions & 47 deletions coupledmodeldriver/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
from pathlib import Path
import shutil
import sys
import tarfile
import traceback
from typing import List

import numpy
from pyproj import CRS, Geod, Transformer
from shapely.geometry import Point
import wget


def repository_root(path: PathLike = None) -> Path:
Expand Down Expand Up @@ -165,50 +162,6 @@ def make_executable(path: PathLike):
os.chmod(path, mode)


def download_mesh(url: str, directory: PathLike, overwrite: bool = False):
if not isinstance(directory, Path):
directory = Path(directory)
if not directory.exists():
directory.mkdir(parents=True, exist_ok=True)

if not (directory / 'fort.14').exists() or overwrite:
logging.info(f'downloading mesh files to {directory}')
extract_download(url, directory, ['fort.13', 'fort.14'])

return directory


def extract_download(
url: str, directory: PathLike, filenames: List[str] = None, overwrite: bool = False
):
if not isinstance(directory, Path):
directory = Path(directory)

if filenames is None:
filenames = []

if not directory.exists():
directory.mkdir(parents=True, exist_ok=True)

temporary_filename = directory / 'temp.tar.gz'
logging.debug(f'downloading {url} -> {temporary_filename}')
wget.download(url, f'{temporary_filename}')
logging.debug(f'extracting {temporary_filename} -> {directory}')
with tarfile.open(temporary_filename) as local_file:
if len(filenames) > 0:
for filename in filenames:
if filename in local_file.getnames():
path = directory / filename
if not path.exists() or overwrite:
if path.exists():
os.remove(path)
local_file.extract(filename, directory)
else:
local_file.extractall(directory)

os.remove(temporary_filename)


class ProcessPoolExecutorStackTraced(ProcessPoolExecutor):
"""
preserves the traceback of any kind of raised exception
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,19 @@ enable = true

[tool.poetry.dependencies]
python = '^3.7'
adcircpy = '>=1.1.2'
adcircpy = '^1.2.1'
file-read-backwards = '*'
nemspy = '>=1.0.4'
numpy = '*'
pyproj = '*'
typepigeon = '>=1.0.3'
typepigeon = '^1.0.3'
isort = { version = '*', optional = true }
oitnb = { version = '*', optional = true }
pooch = { version = '*', optional = true }
pytest = { version = '*', optional = true }
pytest-cov = { version = '*', optional = true }
pytest-socket = { version = '*', optional = true }
pytest-xdist = { version = '*', optional = true }
wget = { version = '*', optional = true }
m2r2 = { version = '*', optional = true }
sphinx = { version = '*', optional = true }
sphinx-rtd-theme = { version = '*', optional = true }
Expand Down

0 comments on commit a97e5ec

Please sign in to comment.