Download and decode functions for NEXRAD radar data.
I consulted the following resources when developing this library:
https://github.com/bwiggs/go-nexrad
https://trmm-fc.gsfc.nasa.gov/trmm_gv/software/rsl/
This library provides functions to download and decode NEXRAD Level II data from AWS uploaded in near real-time by NOAA.
The download
feature may be enabled to download NEXRAD Level II data from AWS. For more information on this data
source, see the Registry of Open Data's page. As the radar rotates or
"sweeps" it collects data which is aggregated into messages. The messages are broken into 5-minute "chunks" before being
compressed and uploaded to AWS.
The data is organized by site and date. Here is an example of downloading the first file for April 6, 2023 from KDMX: ```rust let site = "KDMX"; let date = NaiveDate::fromymdopt(2023, 4, 6).expect("is valid date");
let metas = listfiles(site, &date).await?; if let Some(meta) = metas.first() { println!("Downloading {}...", meta.identifier()); let downloadedfile = download_file(meta).await?;
println!("Data file size (bytes): {}", downloaded_file.len());
println!("Data file is compressed: {}", is_compressed(downloaded_file));
} else { println!("No files found for the specified date/site to download."); } ```
In this example, list_files
is being used to query which files are available for the specified site and date, and
download_file
is used to download the contents of the first file. The downloaded file will need to be decompressed and
decoded before the data can be inspected.
Raw data files are compressed with bzip2 and must be decompressed prior to decoding. Here is an example of decompressing a file: ```rust let compressed_file = ...;
println!("Data file size (bytes): {}", compressedfile.data().len()); println!("Data file is compressed: {}", compressedfile.compressed());
let decompressedfile = decompressfile(&compressedfile)?; println!("Decompressed data file size (bytes): {}", decompressedfile.data().len()); println!("Decompressed data file is compressed: {}", decompressed_file.compressed()); ```
A decompressed data file consists of binary-encoded messages containing sweep data. Here is an example of decoding a file: ```rust let decompressed_file = ...;
let decoded = decodefile(&decompressedfile)?; println!("Decoded file with {} elevations.", decoded.elevation_scans().len()); ```