Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates metget #6

Merged
merged 6 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
597 changes: 189 additions & 408 deletions cht_meteo/cht/meteo/coamps_tc_forecast.py

Large diffs are not rendered by default.

23 changes: 1 addition & 22 deletions cht_meteo/cht/meteo/coamps_tc_forecast_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from cht_utils import fileops as fo

from cht_meteo.cht.meteo.dataset import MeteoDataset
from cht_meteo.cht.meteo.metget_utils import get_storm_track


class MeteoSubset:
Expand Down Expand Up @@ -171,25 +172,3 @@ def convert_coamps_nc_to_meteo_nc(inpfile, outfile):

# Write output file
ds.to_netcdf(outfile)


def get_storm_track(track_path: str, year: int, storm: str, cycle: str):
"""
Retrieves the storm track data for a given year, storm, and cycle.

Parameters:
year (int): The year of the storm track data.
storm (str): The name of the storm.
cycle (str): The cycle of the storm track data.

Returns:
bytes: The content of the storm track data.

"""
try:
filename = os.path.join(track_path, f"TRK_COAMPS_CTCX_3_{cycle}_{storm}.trk")
url = f"https://coamps-tc-data.s3.us-east-2.amazonaws.com/deterministic/realtime/{year}/{storm}/{cycle}/TRK_COAMPS_CTCX_3_{cycle}_{storm}"
urllib.request.urlretrieve(url, filename)
except Exception as e:
print(f"Error downloading {url}")
print(e)
Loading
Loading