Weather Data
Last updated
Last updated
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.
To directly work with the jupyter notebook, click here:
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 , and AISdb set up either locally or remotely. Refer to the documentation for detailed instructions and configuration options.
Once you have a Copernicus CDS account and AISdb installed, you can download weather data in GRIB format directly from the CDS and use AISdb to extract specific variables from those files.
AISdb supports both zipped (.zip
) and uncompressed GRIB (.grib
) files. These files should be named using the yyyy-mm
format (e.g., 2023-03.grib
or 2023-03.zip
) and placed in a folder such as /home/CanadaV2
.
With the WeatherDataStore
class in AISdb, you can specify:
The desired weather variables (e.g., '10u'
, '10v'
,tp
),
A date range (e.g., August 1 to August 30, 2023),
And the directory where the GRIB files are stored.
To automatically download GRIB files from the Copernicus Climate Data Store (CDS), AISdb provides a convenient option using the WeatherDataStore
class.
Simply set the parameter download_from_cds=True
, and specify the required weather variable short names, date range, target area, and output path.
To extract weather data for specific latitude, longitude, and timestamp values, call the yield_tracks_with_weather()
method. This returns a dictionary containing the requested weather variables for each location-time pair.
Output:
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".
Let's work on an example where we retrieve AIS tracks from AISdb , call WeatherDataStore to add weather data to the 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.
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.
By using the method weather_data_store.yield_tracks_with_weather(tracks)
, the tacks are concatenated with weather data.
Example usage:
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.
For a list of short names for different weather components, refer to:
Here, 10v
and 10u
are the and the .