-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add functions related to storm track
- Loading branch information
1 parent
a3d1c2b
commit a6f32b6
Showing
7 changed files
with
86 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#################################################### | ||
""" | ||
gmttrack(track::VisClaw.Track; kwargs...) | ||
gmttrack!(track::VisClaw.Track; kwargs...) | ||
""" | ||
gmttrack(track::VisClaw.Track; kwargs...) = GMT.plot(track.lon, track.lat; kwargs...) | ||
#################################################### | ||
""" | ||
$(@doc gmttrack) | ||
""" | ||
gmttrack!(track::VisClaw.Track; kwargs...) = GMT.plot!(track.lon, track.lat; kwargs...) | ||
#################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
################################### | ||
""" | ||
track = loadtrack("simlation/path/_output"::String) | ||
track = loadtrack("simlation/path/_output/fort.track"::String) | ||
Function: fort.track reader | ||
""" | ||
function loadtrack(outdir::String) | ||
## definition of filename | ||
fname = occursin("fort.track", basename(outdir)) ? outdir : joinpath(outdir, "fort.track") | ||
## check | ||
isfile(fname) || error("File $fname is not found.") | ||
|
||
## load | ||
datorg = readdlm(fname) | ||
datorg[datorg.>1e30] .= NaN | ||
|
||
## return | ||
return VisClaw.Track(datorg[:,1], datorg[:,2], datorg[:,3], datorg[:,4]) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#################################################### | ||
""" | ||
plt = plotstrack(track::VisClaw.Track; kwargs...) | ||
plotstrack!(plt::Plots.Plot, track::VisClaw.Track; kwargs...) | ||
plot a typhoon/hurricane track using Plots | ||
""" | ||
function plotstrack!(plt, track::VisClaw.Track; kwargs...) | ||
# parse keyword args | ||
kwdict = KWARG(kwargs) | ||
label, kwdict = VisClaw.kwarg_default(kwdict, VisClaw.parse_label, "") | ||
|
||
# plot | ||
plt = Plots.plot!(plt, track.lon, track.lat; axis_ratio=:equal, label=label, kwdict...) | ||
return plt | ||
end | ||
#################################################### | ||
""" | ||
$(@doc plotstrack!) | ||
""" | ||
plotstrack(track::VisClaw.Track; kwargs...) = plotstrack!(Plots.plot(), track; kwargs...) | ||
#################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters