Skip to content

Commit 1cf183b

Browse files
committed
Add baselon as an optional argument to load
1 parent df39cc4 commit 1cf183b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

huracanpy/_data/_load.py

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pandas as pd
22

3+
34
from . import _csv, _TRACK, _netcdf, _tempestextremes
45
from . import ibtracs
56
from .. import utils
@@ -25,6 +26,7 @@ def load(
2526
variable_names=None,
2627
rename=dict(),
2728
add_info=False,
29+
baselon=None,
2830
ibtracs_online=False,
2931
ibtracs_subset="wmo",
3032
ibtracs_clean=True,
@@ -74,6 +76,9 @@ def load(
7476
>>> tracks = huracanpy.load(..., rename=dict(longitude="longitude"))
7577
7678
add_info : bool, default=False
79+
baselon : scalar, optional
80+
Force the loaded longitudes into the range (baselon, baselon + 360). e.g.
81+
(0, 360) or (-180, 180)
7782
ibtracs_online : bool, default=False
7883
* **False**: Use a small subset of the IBTrACS data included in this package
7984
* **True**: Download the IBTrACS data
@@ -212,6 +217,9 @@ def load(
212217
if len(rename) > 0:
213218
data = data.rename(rename)
214219

220+
if baselon is not None:
221+
data["lon"] = ((data.lon - baselon) % 360) + baselon
222+
215223
if add_info: # TODO : Manage potentially different variable names
216224
data["hemisphere"] = utils.geography.get_hemisphere(data.lat)
217225
data["basin"] = utils.geography.get_basin(data.lon, data.lat)

0 commit comments

Comments
 (0)