Skip to content
21 changes: 20 additions & 1 deletion bluemath_tk/config/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
GEOOCEAN_THREDDS_DATA,
"GEOOCEAN/SHyTCWaves_bulk/mda_mask_indices_lowres.nc",
),
"SHYTCWAVES_SPECTRA": op.join(
GEOOCEAN_CLUSTER_DATA,
"GEOOCEAN/SHyTCWaves/",
),
}


Expand All @@ -52,16 +56,31 @@ def update_paths(new_paths: dict) -> None:
PATHS.update(new_paths)


def get_paths() -> dict:
def get_paths(verbose: bool = True) -> dict:
"""
Get the paths dictionary.

Parameters
----------
verbose : bool, optional
Whether to print warnings about Thredds paths. Default is True.

Returns
-------
dict
Dictionary containing the paths.
"""

if verbose:
for file_name, file_path in PATHS.items():
if "thredds" in file_path:
print(f"WARNING: {file_name} is a Thredds path.")
print(
"You can update any path or add new paths with the update_paths function,"
" from bluemath_tk.config.paths."
)
print("Example: update_paths({'SHYTCWAVES_COEFS': '/new/path/to/data'})")

return PATHS


Expand Down
3 changes: 3 additions & 0 deletions bluemath_tk/core/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
RAD2DEG = 180.0 / pi


# TODO: Check which functions are implemented in Pyproj library!


def convert_to_radians(*args: Union[float, np.ndarray]) -> tuple:
"""
Convert degree inputs to radians.
Expand Down
11 changes: 6 additions & 5 deletions bluemath_tk/downloaders/noaa/noaa_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ def download_data(
----------
data_type : str
The data type to download.
- 'bulk_parameters'
- 'wave_spectra'
- 'directional_spectra'
- 'wind_forecast'
- 'bulk_parameters'
- 'wave_spectra'
- 'directional_spectra'
- 'wind_forecast'

load_df : bool, optional
Whether to load and return the DataFrame after downloading.
Default is False.
Expand Down Expand Up @@ -739,7 +740,7 @@ def _read_directional_file(self, file_path: Path) -> Optional[pd.DataFrame]:
header_lines = []
while True:
line = f.readline().strip()
if not line.startswith("#"):
if not line.startswith("#") or not line.startswith("YYYY"):
break
header_lines.append(line)

Expand Down
Loading