Hi,
I am doing back trajectories on R studio using openair manual. The study site in focus is in South Africa. When I do the traj plot by seasons in R studio using the code from the openair manual, it plots the seasons assuming the northern hemisphere seasons for example DJF being winter in the North and DJF being summer in my side. I have tried to change season format and it did not work. It plotted DJF as winter, MAM as spring, JJA as summer and SON as autumn which is wrong for my study site. DJF should be summer, MAM should be autumn, JJA should be winter and SON should be spring. Here is my code, please help:
library(openair)
library(tidyverse)
library(lubridate)
library(devtools)
source_gist("https://gist.github.com/davidcarslaw/c6 ... 7796e4bdf5",
filename = "run_hysplit.R")
###this is a default do not change anything###
getMet <- function(year = 2013, month = 1,
path_met = "~/TrajData/") {
for (i in seq_along(year)) {
for (j in seq_along(month)) {
download.file(
url = paste0(
"https://www.ready.noaa.gov/data/archives/reanalysis/RP",
year, sprintf("%02d", month[j]), ".gbl"
),
destfile = paste0(
path_met, "RP", year,
sprintf("%02d", month[j]), ".gbl"
),
mode = "wb"
)
}
}
}
### change here if you want to download a specific year or set to a different path file###
getMet(year = 2022, month = 1:12, path_met = "C:\\PostDoc_UP\\Projects\\Students\\Sihle\\")
data_out <- run_hysplit(
latitude = -28.704083, ### spioenkop lat in decimal degrees
longitude = 29.525928, ### spioenkop lon in dec degrees
runtime = -24, ### short compared to -96
start_height = 3100, ### the desired starting height
model_height = 10000,
start = 2022, ###the desired year
end = "2022-12-31",
hysplit_exec = "C:\\hysplit\\exec",
hysplit_input = "C:\\PostDoc_UP\\Projects\\Students\\Sihle\\",
hysplit_output = "C:\\PostDoc_UP\\Projects\\Students\\Sihle",
site = "spioenkop") ###the name of my study site
saveRDS(data_out, file = "C:\\PostDoc_UP\\Projects\\Students\\Sihle\\myTrajData.rds")
skp_2022 <- readRDS("C:\\PostDoc_UP\\Projects\\Students\\Sihle\\myTrajData.rds") ###named it sk_2022 instead of traj
##change seasons to southern hemisphere seasons
skp_2022$date2 <- as.POSIXct(skp_2022$date2, format = "%Y-%m-%d %H:%M:%S")
New_Season <- function(date) { new_date <- as.Date(format(date, "%Y-12-%d"))
#Modify the month component by subtracting the current month from 12 (December)
new_date <- as.Date(format(new_date, "%Y-%m-%d"))
return(new_date)
}
# Modify dates for the Southern Hemisphere
skp_2022$date_southern <- New_Season(skp_2022$date2)
## plot trajectories
trajPlot(selectByDate(skp_2022, start = "1/1/2022", end = "31/12/2022"),
group = "season", col = "jet", lwd = 2, key.pos = "top",
key.col = 4)
Hysplit on R studio:How to change northern hemisphere seasons to southern hemisphere seasons
General questions and postings pertaining to the use of HYSPLIT regardless of the platform. For platform specific questions, use the HYSPLIT Platform forums.
-
- Posts: 6
- Joined: June 15th, 2022, 8:01 am
- Registered HYSPLIT User: No
- Location: South Africa
Jump to
- HYSPLIT
- ↳ Users
- ↳ Developers
- ↳ Bugs
- ↳ Announce
- ↳ General Comments
- ↳ Trajectory Model
- ↳ Dispersion Model
- ↳ User Applications
- ↳ In-line WRF-HYSPLIT coupling
- HYSPLIT Platform Specific
- ↳ HYSPLIT for PCs
- ↳ HYSPLIT for Mac OS X
- ↳ HYSPLIT for LINUX
- ↳ HYSPLIT on the READY Server
- Meteorological Data
- ↳ General questions on meteorological data needed for HYSPLIT
- ↳ Conversion programs
- ↳ Repositories of HYSPLIT formatted data
- ↳ MeteoInfo Software
- HYSPLIT Research
- ↳ Volcanic Ash
- ↳ Wildfire Smoke
- ↳ Dust
- ↳ Chemicals
- ↳ Radiological
- ↳ Cluster Analysis
- HYSPLIT Workshop
- ↳ 2022 HYSPLIT Workshop Questions
- ↳ 1. Installing HYSPLIT
- ↳ 2. Testing the installation
- ↳ 3. Gridded meteorological data files
- ↳ 4. Trajectory calculations
- ↳ 5. Trajectory options
- ↳ 6. Trajectory statistics
- ↳ 7. Air concentration calculations
- ↳ 8. Configuring the CAPTEX simulation
- ↳ 9. Air concentration parameter sensitivity
- ↳ 10. Alternate display options
- ↳ 11. Pollutant transformations and deposition
- ↳ 12. Air concentration uncertainty
- ↳ 13. Source attribution methods
- ↳ 14. Wildfire smoke and dust storms
- ↳ 15. Radioactive pollutants and dose
- ↳ 16. Volcanic eruptions with gravitational settling
- ↳ 17. Custom simulations
- ↳ 2021 HYSPLIT Workshop Questions
- ↳ 1. Installing HYSPLIT
- ↳ 2. Testing the installation
- ↳ 3. Gridded meteorological data files
- ↳ 4. Trajectory calculations
- ↳ 5. Trajectory options
- ↳ 6. Trajectory statistics
- ↳ 7. Air concentration calculations
- ↳ 8. Configuring the CAPTEX simulation
- ↳ 9. Air concentration parameter sensitivity
- ↳ 10. Alternate display options
- ↳ 11. Pollutant transformations and deposition
- ↳ 12. Air concentration uncertainty
- ↳ 13. Source attribution methods
- ↳ 14. Wildfire smoke and dust storms
- ↳ 15. Radioactive pollutants and dose
- ↳ 16. Volcanic eruptions with gravitational settling
- ↳ 17. Custom simulations
- ↳ 2020 HYSPLIT Workshop Questions
- ↳ 1. Installing HYSPLIT
- ↳ 2. Testing the installation
- ↳ 3. Gridded meteorological data files
- ↳ 4. Trajectory calculations
- ↳ 5. Trajectory options
- ↳ 6. Trajectory statistics
- ↳ 7. Air concentration calculations
- ↳ 8. Configuring the CAPTEX simulation
- ↳ 9. Air concentration parameter sensitivity
- ↳ 10. Alternate display options
- ↳ 11. Pollutant transformations and deposition
- ↳ 12. Air concentration uncertainty
- ↳ 13. Source attribution methods
- ↳ 14. Wildfire smoke and dust storms
- ↳ 15. Radioactive pollutants and dose
- ↳ 16. Volcanic eruptions with gravitational settling
- ↳ 17. Custom simulations
- ↳ 2019 HYSPLIT Workshop Questions