Skip to content

Commit

Permalink
Update use of IBtracs file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chahan Kropf committed Dec 9, 2024
1 parent 8364418 commit b84f70a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions climada_petals/hazard/test/test_tc_rainfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
from scipy import sparse
import xarray as xr

from climada import CONFIG
from climada.hazard import Centroids, TCTracks
import climada.hazard.test as hazard_test
from climada.hazard.TCTracks import IBTRACS_FILE
from climada_petals.hazard.tc_rainfield import (
TCRain,
compute_rain,
Expand All @@ -42,6 +41,7 @@
from climada.util.constants import SYSTEM_DIR



def getTestData():
client = Client()
centr_ds = client.get_dataset_info(name='tc_rainfield_test', status='test_dataset')
Expand Down Expand Up @@ -112,7 +112,7 @@ def test_tcr(self):
self.assertAlmostEqual(tc_haz.intensity[0, 100], 123.55255892009247)
self.assertAlmostEqual(tc_haz.intensity[0, 260], 15.148539942329757)

@unittest.skipUnless(SYSTEM_DIR.joinpath("IBTrACS.ALL.v04r00.nc").is_file(),
@unittest.skipUnless(SYSTEM_DIR.joinpath(IBTRACS_FILE).is_file(),
"IBTrACS file is missing, no download in unitttests")
def test_cross_antimeridian(self):
# Two locations on the island Taveuni (Fiji), one west and one east of 180° longitude.
Expand Down
5 changes: 3 additions & 2 deletions climada_petals/hazard/test/test_tc_surge_bathtub.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import xarray as xr

from climada.hazard import Centroids, TCTracks, TropCyclone
from climada.hazard.TCTracks import IBTRACS_FILE
from climada_petals.hazard.tc_surge_bathtub import _fraction_on_land, TCSurgeBathtub
from climada.util.constants import SYSTEM_DIR

Expand Down Expand Up @@ -95,7 +96,7 @@ def test_fraction_on_land(self):
shape = (lat.size, lon.size)
lon, lat = [ar.ravel() for ar in np.meshgrid(lon, lat)]
centroids = Centroids.from_lat_lon(lat, lon)

dem_bounds = (bounds[0] - 1, bounds[1] - 1, bounds[2] + 1, bounds[3] + 1)
dem_res = 3 / (60 * 60)
with tmp_artifical_topo(dem_bounds, dem_res) as topo_path:
Expand Down Expand Up @@ -176,7 +177,7 @@ def test_surge_from_track(self):
self.assertAlmostEqual(inten[9, 31], max(-1.270 + slr, 0), places=2)
self.assertAlmostEqual(inten[14, 34] - slr, 2.805, places=2)

@unittest.skipUnless(SYSTEM_DIR.joinpath("IBTrACS.ALL.v04r00.nc").is_file(),
@unittest.skipUnless(SYSTEM_DIR.joinpath(IBTRACS_FILE).is_file(),
"IBTrACS file is missing, no download in unitttests")
def test_cross_antimeridian(self):
# Two locations on the island Taveuni (Fiji), one west and one east of 180° longitude.
Expand Down

0 comments on commit b84f70a

Please sign in to comment.