티스토리 뷰

genTraj_HYSPLIT_autocopy.m


1. Introduction

This MATLAB script can be used to automatically generate backward trajectory files from a list of dates on which trajectories reach a certain location specified with a lontitudinal coordinate, a latitudinal coordiante, and a given altitude. The operational environment that is supported by the script is Windows only. There is no guarantee for its use in other platforms.

The .zip archive mainly contains the following files:

genTraj_HYSPLIT_autocopy.m: The script.
HYSPLIT_... .m: Function files that are called for. These function files are from the following contribution developed by gmwolfe: AirChem/HYSPLITcontrol (see below at 4. Acknowledgements).

 

 

A screenshot of the run of the script. Trajectory files are being automatically generated in the directory of C:\Temp\trajectories .

 


2. Prerequisites

In order to use the script, one must have the following things available locally, i.e., on one's own PC:

(a) a local installation of the HYSPLIT software for PC, which is downloadable at
https://www.ready.noaa.gov/HYSPLIT_hytrial.php ,

and

(b) meteorological data files from GDAS covering the time period of interest, which are available at

ftp://arlftp.arlhq.noaa.gov/archives/gdas1/ .


The meteorological data files of (b) must be downloaded on a directory, which is specified in the script as gdas1Path.

Also, the directory containing all the function files whose name beginning with "HYSPLIT_" must be in the MATLAB path, in order to use the script properly.

 

 

3. How to Use


3.1. Preparation of the meteorological data files

The meteorological data files from GDAS covering the time period of interest must be available in a directory. The directory name must be given as the string variable gdas1Path in the script.

 

For example, if you want trajectory files for the entire year 2006, you must have all the files related to the year, typically 5 files per each month, plus a few additional files covering the last part of year 2005 and the first part of year 2007 to ensure some elbow rooms for trajectory calculations. Since the typical size of the files is pretty large, it is recommended to have them stored in a HDD of significant capacity.


The number of GDAS files in the directory specified in gdas1Path is not limited and can be very large, since the directory specified in gdas1Path is not the directory directly referenced by the local installation of the HYSPLIT software for PC (this directory is specified in another variable, i.e., metPath), which seems to be able to handle a very limited number (about 10) of meteorological data files at one time.

 



3.2. Preparation of an .xlsx file specifying the dates and times at which trajectories reach a given location

 

To use this script, you must frist prepare a so called "Trajectory and Concentration Data" file, which is an .xlsx file, looking like the following:

 

A B
2006100414.txt 0
2006100415.txt 0.128
: :

 

Column A contains the file names of each trajectory file, which is given in the following format: yyyymmddhh.txt . The extension does not have to be .txt, but the first column must contain text data, NOT numbers. To ensure everything is okay, to manually set the cell format of Column A to "text" before saving the file.

 

Column B is not a must for preparing the trajectory files, but it may contain measured concentrations of pollutants corresponding to each trajectory, for later use in cPSDF.m ( https://leteewha.tistory.com/77 ).

 

The list can be pretty long. A test confirms that the script can automatically generate more than one thousand trajectory files in a single run. 

 

 

3.3. Edit the script to set proper inputs

 

All the input variables are in the section %% INPUTS.

 

%% INPUTS
gdas1Path='C:\Temp\gdas1\'; % PATH FOR DIRECTORY CONTAINING GDAS1 FILES.
→ gdas1Path specifies the location of the directory where the meteorological files of GDAS are stored.

 

% paths
hysplitPath='C:\hysplit\'; %HYSPLIT core directory
→ hysplitPath specifies the top directory where the local installation of the HYSPLIT software for PC is.

metPath='C:\Temp\gdas1tmp\'; %directory containing met files to be used
% during the run of the HYSPLIT code. Met files are automatically
% copied from gdas1Path above.
% A short path is recommended to avoid a trouble.
% ALWAYS PUT \ AT THE END FOR DIRECTORIES.
→ metPath specifies the location of a temporary directory to which a small number of meteorological files are copied from gdas1Path during the actual run of the HYSPLIT software for PC. Necessary meteorological files will be automatically copied during the run of the script. This temporary directory becomes necessary, because the HYSPLIT software for PC cannot run with too many meteorological files. Thus, only a small number of files are temporarily copied to this directory for each run of the software.

 

% INPUT FILE
% "Trajectory and % Concentration Data" file

filename='C:\Temp\trajectories\list.xlsx';

→ filename specifies the so called "Trajectory and Concentration Data" file (see above).

tZoneSpec='+09:00'; % The time zone for the file names in Col A
% REPUBLIC OF KOREA +9 GMT
→ tZoneSpec specifies the time zone in which the times are given in Col A of the file specified with filename.

% THE LOCATION OF THE SAMPLING SITE, I.E., FINAL LANDING POINT OF THE
% BACKWARD TRAJECTORIES
lat=37.500; % LATITUDE
lon=127.000; % LONGITUDE
alt=1500.0; % ALTITUDE
→ The location of the site where each trajectory reaches as the final landing point is specified here.

% options
param.runTime = -72; %trajectory run time in h. Back-traj are negative.

param.top = 20000; %top of model, m (MUST BE LARGE ENOUGH)
param.outPath = 'C:\Temp\trajectories\'; %place to stuff output files
% A short path is recommended to avoid a trouble.
% ALWAYS PUT \ AT THE END FOR DIRECTORIES.
param.modelType = 'std'; % not ensemble!
→ Other options. Mostly pretty much straightforward even without any lengthy explanation.

 

 

4. Acknowledgement

This script is developed based on the following contribution developed by gmwolfe:

AirChem/HYSPLITcontrol

https://github.com/AirChem/HYSPLITcontrol/commit/4d94c013458bab56bd0f005b67a12f1a9fbb4302

 

better readme · AirChem/HYSPLITcontrol@4d94c01

Permalink This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. Browse files better readme Loading branch information Showing 1 changed file with 5 additions and 0 deletions. +5 −0 README.md @@

github.com

 

 

5. Correspondence

Questions and comments should be addressed to:

Daehyun Wee, Sc.D.
Associate Professor
Department of Environmental Science and Engineering
Ewha Womans University
Seoul, Republic of Korea

dhwee@ewha.ac.kr

 

20210315_genTraj_HYSPLIT.zip
0.03MB
genTraj_HYSPLIT_autocopy.m
0.01MB

A version of the script with minor correction is attached separately.