Weather Data
This tutorial introduces integrating weather data from GRIB files with AIS data for enhanced vessel tracking analysis. Practical examples are provided below illustrating how to integrate AISdb tracks with the weather data in GRIB files.
Prerequisites
Before diving in, users are expected to have the following set-up: a Copernicus CDS account (free) to access ERA5 data, which can be obtained through the ECMWF-Signup, and AISdb set up either locally or remotely. Refer to the AISDB-Installation documentation for detailed instructions and configuration options.
Usage:
Once you have your Copernicus CDS account and AISdb installation ready, you can leverage AISdb to extract weather data from GRIB files.
When working with weather data, users can extract GRIB files using the AISdb. These GRIB files should be zipped and organized with filenames in the "yyyy-mm" format (e.g., "2023-03"). For example, the WeatherDataStore object can be initialized with the required weather components, identified by their short names (e.g., '10v', '10u'), a date range (e.g., from August 1, 2023, to August 30, 2023), and the file path to the zipped GRIB files
(e.g., "/home/CanadaV2").
To extract weather data for a given latitude, longitude, and timestamp, users can call the yield_tracks_with_weather method of the WeatherDataStore
object, which will return the value of the requested weather component as a dictionary. Here's an example of how this can be done:
Output:
What are short_names
?
short_names
?In ECMWF (European Centre for Medium-Range Weather Forecasts) terminology, a "short name" is a concise, often abbreviated, identifier used to represent a specific meteorological parameter or variable within their data files (like GRIB files). It typically refers to a concise identifier used for climate and weather data variables. For example, "t2m" is a short name for "2-meter temperature".
For a list of short names for different weather components, refer to: https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#heading-Parameterlistings
Example
Let's work on an example where we retrieve AIS tracks from AISdb , call WeatherDataStore to add weather data to the tracks.
Step 1: Import all necessary packages
Step 2: Connect to the database
Step 3: Query the required tracks
Specify the region and duration for which you wish the tracks to be generated. The TrackGen
returns a generator containing all the dynamic and static column values of AIS data.
Step 4: Specify the necessary weather components using short_name convention
Next, to merge the tracks with the weather data, we need to use the WeatherDataStore
class from aisdb.weather.era5
. By calling the WeatherDataStore
with the required weather components (using their short names) and providing the path to your GRIB file containing the weather dataset, it will open the file and return an object through which you can perform further operations.
Here, 10v
and 10u
are the 10 metre U wind component and the 10 metre V wind component.
Step 5: Fetch Weather Values for a given latitude ,longiture and time
By using the method weather_data_store.yield_tracks_with_weather(tracks)
, the tacks are concatenated with weather data.
Example usage:
Why do we need to integrate weather data with AIS data?
By integrating weather data with AIS data , we can study the patterns of ship movement in relation to weather conditions. This integration allows us to analyze how factors such as wind, sea surface temperature, and atmospheric pressure influence vessel trajectories. By merging dynamic AIS data with detailed climate variables, we can gain deeper insights into the environmental factors affecting shipping routes and optimize vessel navigation for better efficiency and safety.
Last updated