hyspdisp_fac_model: Run Hysplit dispersion, save data, link to zips

Description Usage Arguments Value Author(s)

View source: R/hyspdisp_fac_model.R

Description

hyspdisp_fac_model takes multiple inputs and outputs counts of particles per zip code. hyspdisp_fac_model_parallel is a parallelized version applicable for functions such as mclapply.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
hyspdisp_fac_model(run_ref_tab,
                   start_day,
                   start_hour,
                   duration_emiss_hours,
                   duration_run_hours,
                   unit,
                   species,
                   zcta2,
                   crosswalk,
                   hpbl_raster,
                   npart = 100,
                   overwrite = F,
                   link2zip = T,
                   prc_dir = NULL,
                   hyo_dir = NULL,
                   current_dir = getwd(),
                   met_dir = file.path( getwd(), 'metfiles'),
                   bin_path = NULL,
                   keep.hysplit.files = FALSE)

hyspdisp_fac_model_parallel(x,
                            run_ref_tab,
                            unit,
                            species,
                            zcta2,
                            crosswalk,
                            hpbl_raster,
                            npart = 100,
                            overwrite = F,
                            link2zip = T,
                            prc_dir = NULL,
                            hyo_dir = NULL,
                            current_dir = getwd(),
                            met_dir = file.path( getwd(), 'metfiles'),
                            bin_path = NULL,
                            keep.hysplit.files = FALSE)

Arguments

x

row numbers of run_ref_tab, to be used in looping function, e.g., lapply or parallel:mclapply.

run_ref_tab

table of parameters in required in hyspdisp_fac_model_parallel and hyspdisp_fac_model if start_hour, start-day, duration_emiss_hours, and duration_run hours are not provided. Should include columns named "start_hour", "start_day", "duration_emiss_hours", and "duration_run hours".

start_hour

numeric starting hour of dispersion event (0,23). Optional if run_ref_tab included.

start_day

starting date of dispersion event in format YYYY-MM-DD. Optional if run_ref_tab included.

duration_emiss_hours

numeric duration of emission event. Optional if run_ref_tab included.

duration_run

numeric duration of simulation. Optional if run_ref_tab included.

unit

single emissions unit information, including columns named ID, Latitude, Longitude, Height.

species

particle species name as character. One either of 'so2' or 'so4'.

npart

number of particles emitted per hour. Defaults to 100.

current_dir

working directory. Defaults to current directory.

prc_dir

run directory. Defaults to NULL. If NULL, creates a directory in the current_dir named hyspdisp_TODAYSDATE.

hyo_dir

HYSPLIT output directory. Defaults to NULL. If NULL, creates a directory in the prc_dir named partial_trimmed_parcel_locs.

bin_path

path to HYSPLIT binaries. Defaults to NULL. If NULL, uses the SplitR default install location.

zcta2

ZCTA code SpatialPolygonsDataFrame object. The expected variable name is: ZCTA5CE10. The file can be downloaded from the US census page: http://www2.census.gov/geo/tiger/GENZ2017/shp/cb_2017_us_zcta510_500k.zip.

crosswalk

ZIP - ZCTA crosswalk file. Must include columns named ZIP and ZCTA

hpbl_raster

monthly mean boundary layer heights from NOAA's Earth System Research Library: https://www.esrl.noaa.gov/psd/data/gridded/data.20thC_ReanV2.monolevel.mm.html.

overwrite

Logical. Overwrite previous hysplit files?

link2zip

Logical. If true, calculate ZIP code concentrations using air parcel locations.

met_dir

Where are the meteorological files stored? Defaults to a directory named "metfiles" in the working directory.

Value

If overwrite = TRUE, hyspdisp_fac_model and hyspdisp_fac_model_parallel write HYSPLIT output files "[prc_dir]/[hyo_dir]/hyspdisp_[unit$ID]_[start_date]_[start_hour].csv" that includes information about each parcel such as the time, date, location, and height.

If link2zip = TRUE, hyspdisp_fac_model and hyspdisp_fac_model_parallel write output files "[prc_dir]/zip_counts/hyspdisp_[unit$ID]_[start_date]_[start_hour].csv".

If link2zip = FALSE, hyspdisp_fac_model returns a data.table of HYSPLIT parcel locations with locations trimmed below 0m and above the highest height in hpbl_raster. If link2zip = FALSE, the returned list also includes a data.table with ZIP codes and air parcel counts.

hyspdisp_fac_model_parallel returns data.tables of saved locations of the relavent files. It is recommended to run hyspdisp_fac_model first as a test.

Author(s)

LH & CC


lhenneman/hyspdisp documentation built on Oct. 17, 2019, 6:29 p.m.