atcf-data-parser¶
A Python parser and command-line utility for the “a-deck” data posted online by the Automated Tropical Cyclone Forecasting System
Intended to read the cyclone forecasts posted as gzipped files to ftp.nhc.noaa.gov/atcf/aid_public/.
Installation¶
Install the package from the Python Package Index (PyPI) with pipenv:
pipenv install atcf-data-parser
Usage¶
You’ll want to start with a URL to a gzipped a-deck file listed in the government FTP at ftp.nhc.noaa.gov/atcf/aid_public/. We will use 2023’s Hurricane Otis, which had the id of ep182023, as our example.
From Python, you can download a pandas dataframe:
import atcf_data_parser
url = "https://ftp.nhc.noaa.gov/atcf/aid_public/aep182023.dat.gz"
df = atcf_data_parser.get_dataframe(url)
Alternatively, from the command line you can output a CSV to stdout:
atcf-data-parser get-comma-delimited-data https://ftp.nhc.noaa.gov/atcf/aid_public/aep182023.dat.gz
Reference¶
Here’s more about how our utilities work.
Python Functions¶
A collection of functions for downloading and parsing ATCF data posted to its public FTP site
- atcf_data_parser.get_dataframe(url: str) DataFrame ¶
Parse a fixed-width file into a pandas DataFrame.
- Parameters:
url (str) – URL of the gzipped file.
- Returns:
DataFrame containing the parsed data.
- Return type:
pandas.DataFrame
Examples
>>> url = "https://ftp.nhc.noaa.gov/atcf/aid_public/aep182023.dat.gz" >>> get_dataframe(url)
- atcf_data_parser.get_gzipped_url(url: str) str ¶
Open a gzipped file from a URL and return its contents as a list of strings.
- Parameters:
url (str) – URL of the gzipped file.
- Returns:
List of strings representing the lines of the file.
- Return type:
str
Examples
>>> url = "https://ftp.nhc.noaa.gov/atcf/aid_public/aep182023.dat.gz" >>> get_gzipped_url(url)
Command-line Interface¶
A command-line utility for downloading and parsing ATCF data posted to its public FTP site
Usage: atcf-data-parser [OPTIONS] COMMAND [ARGS]...
Parse “a-deck” data posted online by the Automated Tropical Cyclone
Forecasting System.
Options:
--help Show this message and exit.
Commands:
get-comma-delimited-data Download a comma-delimited file from a URL...
get-fixed-width-data Download a fixed-width file from a URL and..
get-comma-delimited-data¶
Usage: atcf-data-parser get-comma-delimited-data [OPTIONS] URL
Download a comma-delimited file from a URL and print its contents.
Options:
--help Show this message and exit.
get-fixed-width-data¶
Usage: atcf-data-parser get-fixed-width-data [OPTIONS] URL
Download a fixed-width file from a URL and print its contents.
Options:
--help Show this message and exit.
Links¶
Data dictionary: www.nrlmry.navy.mil/atcf_web/docs/database/new/abdeck.txt
Model definitions: [ftp.nhc.noaa.gov/atcf/docs/nhc_techlist.dat](https://ftp.nhc.noaa.gov/atcf/docs/nhc_techlist.dat_
Packaging: pypi.org/project/atcf-data-parser