Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
88b5adf
[JTH] add change in github tests
tausiaj May 12, 2025
700be57
[JTH] add tcs main files first version to start tracking
tausiaj May 12, 2025
8d501f5
[JTH] add basic working functions to shytc bad format
tausiaj May 12, 2025
256e509
Merge branch 'develop' of https://github.com/GeoOcean/BlueMath_tk int…
tausiaj May 13, 2025
9ee1d58
Merge branch 'feature/shytcwaves' of https://github.com/GeoOcean/Blue…
tausiaj May 13, 2025
08079b9
Merge branch 'develop' of https://github.com/GeoOcean/BlueMath_tk int…
tausiaj May 14, 2025
dbe0c50
Merge branch 'develop' of https://github.com/GeoOcean/BlueMath_tk int…
tausiaj May 15, 2025
eefc8d6
[JTH] cmove geo file to core module
tausiaj May 15, 2025
d147b7a
[JTH] add geo and constants to core, updating constants in models.py …
tausiaj May 15, 2025
e71a988
Merge branch 'develop' of https://github.com/GeoOcean/BlueMath_tk int…
tausiaj May 15, 2025
28de7af
[JTH] add much more docu to tcs folder to start reformatting old code…
tausiaj May 15, 2025
38cff6a
[JTH] delete old mda malfunctioning funcs
tausiaj May 16, 2025
7cb77b9
[JTH] first working version of formatted shytcwaves bulk parameters
tausiaj May 16, 2025
a89bc19
[JTH] reformat mda to make normalized distance calculations available…
tausiaj May 16, 2025
71b9be4
[JTH] provide more robust tests to MDA, ensuring replicability of fit…
tausiaj May 16, 2025
cc25e1c
Merge branch 'develop' of https://github.com/GeoOcean/BlueMath_tk int…
tausiaj May 19, 2025
36e3793
Merge branch 'develop' of https://github.com/GeoOcean/BlueMath_tk int…
tausiaj May 20, 2025
e123718
[JTH] changes in files to use thredds data
tausiaj May 23, 2025
8111295
[JTH] add config paths and tests to start working with thredds
tausiaj May 23, 2025
f0dabcb
Merge branch 'develop' of https://github.com/GeoOcean/BlueMath_tk int…
tausiaj May 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
112 changes: 112 additions & 0 deletions bluemath_tk/config/paths.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import os.path as op
from typing import Dict

from siphon.catalog import TDSCatalog

GEOOCEAN_CLUSTER_DATA = "/lustre/geocean/DATA/"
GEOOCEAN_THREDDS_DATA = "https://geoocean.sci.unican.es/thredds/dodsC/geoceanData/"

# Default paths dictionary
PATHS = {
"SHYTCWAVES_COEFS": op.join(
GEOOCEAN_THREDDS_DATA, "GEOOCEAN/SHyTCWaves_bulk/ibtracs_coef_pmin_wmax.nc"
),
"SHYTCWAVES_BULK": op.join(
GEOOCEAN_THREDDS_DATA,
"GEOOCEAN/SHyTCWaves_bulk/library_shytcwaves_bulk_params_int32.nc",
),
"SHYTCWAVES_MDA": op.join(
GEOOCEAN_THREDDS_DATA,
"GEOOCEAN/SHyTCWaves_bulk/shytcwaves_mda_indices_clean_int32.nc",
),
}


def update_paths(new_paths: dict) -> None:
"""
Update the paths dictionary with new values.

Parameters
----------
new_paths : dict
Dictionary containing new path values to update.

Examples
--------
>>> update_paths({"MY_PATH": "/new/path/to/data"})
"""

PATHS.update(new_paths)


def get_paths() -> dict:
"""
Get the paths dictionary.

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

return PATHS


def get_thredds_catalog() -> TDSCatalog:
"""
Get the Thredds catalog object.

Returns
-------
TDSCatalog
Siphon TDSCatalog object containing the catalog information.
"""

catalog_url = (
"https://geoocean.sci.unican.es/thredds/catalog/geoceanData/catalog.xml"
)

return TDSCatalog(catalog_url)


def get_catalog_folders() -> Dict[str, str]:
"""
Get a dictionary of folder names and their links from the first level of the catalog.

Returns
-------
Dict[str, str]
Dictionary with folder names as keys and their catalog URLs as values.
"""

catalog = get_thredds_catalog()
folders = {}

for name, ref in catalog.catalog_refs.items():
folders[ref.title] = ref.href

return folders


def print_catalog_table() -> None:
"""
Print a formatted table of available folders in the catalog.
"""

folders = get_catalog_folders()

# Print header
print("\nAvailable Folders in GeoOcean Thredds Catalog:")
print("-" * 80)
print(f"{'Folder Name':<20} | {'Catalog URL':<40}")
print("-" * 80)

# Print each folder
for name, url in sorted(folders.items()):
print(f"{name:<20} | {url:<40}")

print("-" * 80)


if __name__ == "__main__":
print_catalog_table()
2 changes: 2 additions & 0 deletions bluemath_tk/core/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
EARTH_RADIUS = 6378.135 # Earth radius in km
EARTH_RADIUS_NM = EARTH_RADIUS / 1.852 # Earth radius in nautical miles
Loading