Skip to content

Commit 92153df

Browse files
committed
Update utils paths for accessor
1 parent b677e69 commit 92153df

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

huracanpy/_accessor.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@
44
from ._data._save import save
55

66
# from huracanpy.subset import trackswhere
7-
from .utils.geography import (
7+
from .utils import (
88
get_hemisphere,
99
get_basin,
1010
get_land_or_ocean,
1111
get_country,
1212
get_continent,
13+
get_ace,
14+
get_pace,
15+
get_time_components,
16+
get_season,
17+
get_category,
18+
get_pressure_cat,
19+
get_sshs_cat,
20+
get_distance,
21+
get_translation_speed,
22+
interp_time,
1323
)
14-
from .utils.ace import get_ace, get_pace
15-
from .utils.time import get_time_components, get_season
16-
from .utils.category import get_category, get_pressure_cat, get_sshs_cat
17-
from .utils.translation import get_distance, get_translation_speed
18-
from .utils.interp import interp_time
1924
from . import plot
2025
from . import diags
2126

tests/test_accessor.py

+14-16
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,47 @@ def test_accessor():
99
# Test get_ accessors output is same as function
1010
## - hemisphere
1111
hemi_acc = data.hrcn.get_hemisphere(lat_name="lat")
12-
hemi_fct = huracanpy.utils.geography.get_hemisphere(data.lat)
12+
hemi_fct = huracanpy.utils.get_hemisphere(data.lat)
1313
assert not any(hemi_acc != hemi_fct), "accessor output differs from function output"
1414
## - basin
1515
basin_acc = data.hrcn.get_basin(lon_name="lon", lat_name="lat")
16-
basin_fct = huracanpy.utils.geography.get_basin(data.lon, data.lat)
16+
basin_fct = huracanpy.utils.get_basin(data.lon, data.lat)
1717
assert not any(
1818
basin_acc != basin_fct
1919
), "accessor output differs from function output"
2020
## - land or ocean
2121
land_ocean_acc = data.hrcn.get_land_or_ocean(lon_name="lon", lat_name="lat")
22-
land_ocean_fct = huracanpy.utils.geography.get_land_or_ocean(data.lon, data.lat)
22+
land_ocean_fct = huracanpy.utils.get_land_or_ocean(data.lon, data.lat)
2323
assert not any(
2424
land_ocean_acc != land_ocean_fct
2525
), "accessor output differs from function output"
2626
## - country
2727
country_acc = data.hrcn.get_country(lon_name="lon", lat_name="lat")
28-
country_fct = huracanpy.utils.geography.get_country(data.lon, data.lat)
28+
country_fct = huracanpy.utils.get_country(data.lon, data.lat)
2929
assert not any(
3030
country_acc != country_fct
3131
), "accessor output differs from function output"
3232
## - continent
3333
continent_acc = data.hrcn.get_continent(lon_name="lon", lat_name="lat")
34-
continent_fct = huracanpy.utils.geography.get_continent(data.lon, data.lat)
34+
continent_fct = huracanpy.utils.get_continent(data.lon, data.lat)
3535
assert not any(
3636
continent_acc != continent_fct
3737
), "accessor output differs from function output"
3838
## - ace
3939
ace_acc = data.hrcn.get_ace(wind_name="wind10")
40-
ace_fct = huracanpy.utils.ace.get_ace(data.wind10)
40+
ace_fct = huracanpy.utils.get_ace(data.wind10)
4141
assert not any(ace_acc != ace_fct), "accessor output differs from function output"
4242

4343
## - pace
4444
pace_acc = data.hrcn.get_pace(pressure_name="slp", wind_name="wind10")
45-
pace_fct, model_fct = huracanpy.utils.ace.get_pace(data.slp, data.wind10)
45+
pace_fct, model_fct = huracanpy.utils.get_pace(data.slp, data.wind10)
4646
assert not any(pace_acc != pace_fct), "accessor output differs from function output"
4747

4848
## - time components
4949
year_acc, month_acc, day_acc, hour_acc = data.hrcn.get_time_components(
5050
time_name="time"
5151
)
52-
year_fct, month_fct, day_fct, hour_fct = huracanpy.utils.time.get_time_components(
52+
year_fct, month_fct, day_fct, hour_fct = huracanpy.utils.get_time_components(
5353
data.time
5454
)
5555
assert all(year_acc == year_fct), "Year component does not match"
@@ -61,17 +61,17 @@ def test_accessor():
6161
season_acc = data.hrcn.get_season(
6262
track_id_name="track_id", lat_name="lat", time_name="time"
6363
)
64-
season_fct = huracanpy.utils.time.get_season(data.track_id, data.lat, data.time)
64+
season_fct = huracanpy.utils.get_season(data.track_id, data.lat, data.time)
6565
assert all(season_acc == season_fct), "Season component does not match"
6666

6767
## - SSHS category
6868
sshs_acc = data.hrcn.get_sshs_cat(wind_name="wind10")
69-
sshs_fct = huracanpy.utils.category.get_sshs_cat(data.wind10)
69+
sshs_fct = huracanpy.utils.get_sshs_cat(data.wind10)
7070
assert all(sshs_acc == sshs_fct), "SSHS category output does not match"
7171

7272
## - Pressure category
7373
pressure_cat_acc = data.hrcn.get_pressure_cat(slp_name="slp")
74-
pressure_cat_fct = huracanpy.utils.category.get_pressure_cat(data.slp)
74+
pressure_cat_fct = huracanpy.utils.get_pressure_cat(data.slp)
7575
assert all(
7676
pressure_cat_acc == pressure_cat_fct
7777
), "Pressure category output does not match"
@@ -80,9 +80,7 @@ def test_accessor():
8080
distance_acc = data.hrcn.get_distance(
8181
lon_name="lon", lat_name="lat", track_id_name="track_id"
8282
)
83-
distance_fct = huracanpy.utils.translation.get_distance(
84-
data.lon, data.lat, data.track_id
85-
)
83+
distance_fct = huracanpy.utils.get_distance(data.lon, data.lat, data.track_id)
8684
np.testing.assert_array_equal(
8785
distance_acc,
8886
distance_fct,
@@ -93,7 +91,7 @@ def test_accessor():
9391
translation_speed_acc = data.hrcn.get_translation_speed(
9492
lon_name="lon", lat_name="lat", time_name="time", track_id_name="track_id"
9593
)
96-
translation_speed_fct = huracanpy.utils.translation.get_translation_speed(
94+
translation_speed_fct = huracanpy.utils.get_translation_speed(
9795
data.lon, data.lat, data.time, data.track_id
9896
)
9997
np.testing.assert_array_equal(
@@ -145,7 +143,7 @@ def test_accessor():
145143
interpolated_data_acc = data.hrcn.interp_time(
146144
freq="1h", track_id_name="track_id", prog_bar=False
147145
)
148-
expected_interpolated_data = huracanpy.utils.interp.interp_time(
146+
expected_interpolated_data = huracanpy.utils.interp_time(
149147
data, freq="1h", track_id_name="track_id", prog_bar=False
150148
)
151149
np.testing.assert_array_equal(

0 commit comments

Comments
 (0)