Visualization
This section will illustrate how to use the APIs for visualizing the data. At the moment it supports all countries affected by the Western-North Pacific (WNP) cyclones. These are:
Country | ISO3 |
---|---|
Brunie | BRN |
China | CHN |
Japan | JPN |
Cambodia | KHM |
South Korea | KOR |
Laos | LAO |
Myanmar | MMR |
Malaysia | MYS |
Philippines | PHL |
North Korea | PRK |
Russia | RUS |
Thailand | THA |
Taiwand | TWN |
Vietnam | VNM |
The countries' ISO3 are used in all APIs of Bagyo.jl for representing the country.
First Plot
To start with the base plot–a plot of the WNP region and the countries surrounding it–with emphasis on a particular country and its climate region of interest, is done as follows:
using Bagyo
f0, a0 = plot(PHL(), :stere);
f0
The plot above gives emphasis on the Philippine Area of Responsibility (PAR).
Adding Best Tracks
From the base plot, we can then add the Best Track data using the lines!
function.
using Bagyo
using Colors
using Makie
get(BestTrack, :jma) # download the JMA Best Track
meta, data = load(BestTrack, :jma);
f1, a1 = with_theme(theme_dark(), resolution=(850, 650)) do
plot(PHL(), :stere);
end;
lines!(a1, data, :jma, linewidth=1, color=RGBAf(1.0, 0.678431, 0.0, 0.15))
a1.title = "Tropical Cyclone Tracks in WNP using JMA";
a1.titlesize = 25;
a1.titlealign = :left;
a1.xlabelpadding = -30;
a1.ylabelpadding = 15;
f1
To run the above code, you need to install the Colors.jl and Makie.jl packages as follows:
using Pkg
Pkg.add("Colors")
Pkg.add("Makie")
The code get(BestTrack, :jma)
downloads the JMA Best Track data from the JMA website. Once downloaded, succeeding run will skip this.
First time plotting of the target country, in this case the Philippines (specified by PHL()
in the plot
function), downloads the polygon for the input country. Once downloaded, succeeding run will skip this.
We added extra theming to the plot above.
Multiple Climate Regions
The following illustrates how to highlight or plot multiple countries' climate regions, these regions correspond to the following countries: Japan, Philippines, Thailand, Taiwan and Vietnam, respectively.
using Bagyo
using Colors
using Makie
f2, a2 = with_theme(theme_dark(), resolution=(850, 650)) do
plot([JPN(), PHL(), THA(), TWN(), VNM()], :stere);
end;
get(BestTrack, :jma) # download the JMA Best Track, Bagyo.jl automatically skips this if data previously downloaded already
meta, data = load(BestTrack, :jma)
lines!(a2, data, :jma, linewidth=1, color=RGBAf(1.0, 0.678431, 0.0, 0.15))
a2.title = "Tropical Cyclone Tracks in WNP using JMA";
a2.titlesize = 25;
a2.titlealign = :left;
a2.ylabelpadding = 15;
a2.xlabelpadding = -30;
f2
The climate boundary above are not official, except for the Philippines. The rest of the climate boundaries of other countries were subjectively provided. Users can specify this, see example in Zooming to Countries' Climate Boundary.
Using IBTrACS
Another example using IBTrACS,
using Bagyo
using Colors
using Makie
f3, a3 = with_theme(theme_dark(), resolution=(850, 650)) do
plot([JPN(), PHL(), THA(), TWN(), VNM()], :stere);
end;
get(BestTrack, :ibtracs) # download the IBTrACS Best Track, Bagyo.jl automatically skips this if data previously downloaded already
data = load(BestTrack, :ibtracs)
lines!(a3, data, :ibtracs, linewidth=1, color=RGBAf(1.0, 0.678431, 0.0, 0.15))
a3.title = "Tropical Cyclone Tracks in WNP using IBTrACS";
a3.titlesize = 25;
a3.titlealign = :left;
a3.ylabelpadding = 15;
a3.xlabelpadding = -30;
f3
IBTrACS has 4000+ tropical cyclone tracks compared to only 1800+ cyclone tracks recorded by JMA.
Zooming to Countries' Climate Boundary
To zoom in and focus on one country, the configuration needs to be specified at inside the Bagyo.jl types for countries (e.g. PHL
, THA
, etc.). For example,
get(BestTrack, :ibtracs) # download the IBTrACS Best Track
data = load(BestTrack, :ibtracs);
country = PHL(
125, # set the center longitude of the map
10, # set the center latitude of the map
(110, 145), # set the longitude limits of the map
(0, 28), # set the latitude limits of the map
(PHL_AR_LON, PHL_AR_LAT) # add the tuples of arrays for the
# longitude and latitude of the climate area monitored
)
f4, a4 = with_theme(theme_dark(), resolution=(770, 650)) do
plot(country, :gall);
end;
lines!(a4, data, :ibtracs, linewidth=1, color=RGBAf(1.0, 0.678431, 0.0, 0.15))
a4.title = "Tropical Cyclone Tracks in the PAR using IBTrACS";
a4.titlesize = 25;
a4.titlealign = :left;
a4.xlabelpadding = -25;
a4.ylabelpadding = 15;
f4