11
ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab HYSPLIT model comes both in executable form, as well as source code form depending on the Operating System. This guide will cover installation of HYSPLIT on Mac using precompiled files, and on Linux using source code. Obtaining the HYSPLIT air pollution model requires registration with NOAA ARL. This usually takes a business day but can extend to a week. Please follow the procedures for registration on the ARL website promptly before installing HYSPLIT (For those who desire to compile through UNIX source code, please mention that in your registration email). Each method has its pros and cons, please refer to the graphic below to find out the method that best suits your needs. Contents 1. ARL Registration 2. Download and Install a. Mac Precompiled Route i. Installation ii. Using Manson Server to convert WRF b. UNIX Source Route i. Installation 3. Common bugs & hints Install Option Compatible with Requires Admin Rights WRF Input Compatible PC PC Y? N* Mac Precompiled Mac N N UNIX Source Linux Y Y

ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide ... · ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide ... · ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab

ATSC595AirPollutionModellingHYSPLITModelQuickGuide-OSX,Linux

Feb.2016M.Fung

TheNOAAAirresearchlabHYSPLITmodelcomesbothinexecutableform,aswellassourcecodeformdependingontheOperatingSystem.ThisguidewillcoverinstallationofHYSPLITonMacusingprecompiledfiles,andonLinuxusingsourcecode.ObtainingtheHYSPLITairpollutionmodelrequiresregistrationwithNOAAARL.Thisusuallytakesabusinessdaybutcanextendtoaweek.PleasefollowtheproceduresforregistrationontheARLwebsitepromptlybeforeinstallingHYSPLIT(ForthosewhodesiretocompilethroughUNIXsourcecode,pleasementionthatinyourregistrationemail).Eachmethodhasitsprosandcons,pleaserefertothegraphicbelowtofindoutthemethodthatbestsuitsyourneeds.

Contents

1. ARLRegistration

2. DownloadandInstalla. MacPrecompiledRoute

i. Installationii. UsingMansonServertoconvertWRF

b. UNIXSourceRoutei. Installation

3. Commonbugs&hints

InstallOption Compatiblewith RequiresAdmin

Rights

WRFInput

Compatible

PC PC Y? N*

MacPrecompiled Mac N N

UNIXSource Linux Y Y

Page 2: ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide ... · ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab

1. Download&ARLRegistration(all)

DownloadsforWindowsPCHysplitdoesnotrequireanARLaccount,butforOSXandlinuxbinaryfiledownload,registrationisneeded.SinceweareusingHysplitforeducationalpurposes,theonly‘credentials’neededisaEOASletterhead,andareferralfromapersonwhoalreadyhasanaccount.

i. RegisterforanNOAAARLaccountathttp://ready.arl.noaa.gov/HYSPLIT_register.phpAfterareadthroughofthedocuments,youwillbepromptedtofillandemailaformtothewebmaster.

ii. Theformrequiresanattachmentofaletterheadoftheaffiliatedinstitution.Forthosewhohaveanmyeosaccount,theEOASletterheadcouldbedownloadedunder“Tools->Downloads”andatthebottom,“EOASletterhead”.

iii. Ifascannerisaccessible,byallmeansprint,fillandscantheform.Thisis

probablythemostlogicalwaybecausetheformalsorequiredasignature.Theformcouldalsobefilledwithanypdfviewer.Adobereaderisprobablytheeasiestwayoffillingthetextsintheform,howeverwhenItrieddoingthatontheWFRTiMacs,adobereaderseemstodistorttheletterhead,notthatitistoobigofanissue.

yuck

Page 3: ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide ... · ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab

Fireofftheemailthearl.webmaster@noaa.govandyouwillreceiveanaccountconfirmationinafewdays.(Forthosewhowantsourcecode,pleasementionthatyourequirethe“UNIXsourcecodeinstructions

Page 4: ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide ... · ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab

2ai.MacDownload&Installation

i. Onceaccountisgranted,gotoARL,Apple-basedHYSPLIT,anddownload“ApplediskimageFile”.

ii. OncediskimageHYSPLIT_mac.dmgisdownloaded,doubleclickandopenthe.dmg.ThereshouldbeadrivepoppinguponyourdesktopcontainingtheHysplitfiles.

iii. Afterinspectingthefolder,copyHysplit4tohomedirectory.Thiscouldbedonebyeithercopy-pastingthroughfinder.Toaccesshomedirectory,gotoanyfolderandclickcmd+upuntilyouhithomeΩ

Or,todothesamethinginterminal,run:

“cp–r/Volumes/Disk\image/Hysplit4~/“

iv. Onelastthingrecommendedinthehysplittutorialsistocopytheguilinktotheafolderinhysplit4.TakealookintheHysplit4directory,goto/Hysplit4/working:Ifyoudonotsee“hysplit4.tcl”,youneedtocreateasymlinkDothisbygoingtoterminalandtyping:

“cd~/Hysplit4/working”“ln–s~/Hysplit4/guicode/hysplit4.tclhysplit4.tcl”

(Thisassumesyou’veputHysplit4intoyourhomedirectory).Toconfirm,type:

“ls~/Hysplit4/working“ Andyoushouldseehysplit4.tcl*inyour/working/directory.

Page 5: ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide ... · ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab

v. Executetheguiwiththefollowingcommand

“(cd~/Hysplit4/working&&./hysplit4.tcl)”

WhenIclickonthewindow,thebuttonsbecomedim/unreadable,butjustclickatabrowser window other than the hysplit window, and the buttons should becomereadableagain.

vi. Simpletest:

Inthemenusinterface,click “Trajectory ->QuickStart->RunExample”“Concentration->QuickStart->RunExample”

Page 6: ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide ... · ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab

2aii.UsingMansonServertoConvertWRFinputfiles

i. WRFinputisformallynotsupportedforMacandPCversionsofHYSPLIT.Thatsaid,sincethe“manson.eos.ubc.ca”classserverrunsonLinux,wecanfirstconverttheWRFfilesonmanson,thenrunHYSPLITonourlocalcomputersForinformationonaccesstomanson,pleasereferto“MansonUserGuide”ForinformationonaccessingUBCWRFdata,referto“WFRTWRFdataGuide”

ii. FiletypePrimer:WRFrunsoutputfilesoftype“netCDF”TheUBCforecastsproducehourlynetCDFdatafiles.ThenetCDFfilesshouldbeavailableunder/scratch/datadirectory.

HYSPLITmeteorologyinputuses.BINbinaryasitsfiletype.

InordertoconvertnetCDFfilesinto.BINfiles,therearetwoexecutablefilesinManson,“prepARW.py,andarw2arl”locatedin/scratch/models/hysplit/exec

iii. PrepareDirectoryConnecttomanson.eos.ubc.ca

“ssh[username]@manson.eos.ubc.ca”CreateadirectorytostoreWRFfiles

Ex.“mkdir~/hysplit“CopyasetofWRFdatatoyourdirectory

“cp–r/scratch/data/wrf_sample~/hysplit/.”RunExecutablesonthefolder“cd~/hysplit/wrf_sample&&python/scratch/models/hysplit/exec/prepARW.py““cd~/hysplit/wrf_sample&&/scratch/models/hysplit/exec/arw2arlwrfout.nc”Thisproducesa.BINfilenamedARLDATA.BIN,whichyoucaninputtoHYSPLIT

iv. TransferfilestolocalcomputerBringyourterminalbacktothelocalcomputer,cdtothefolderwhichyouwanttocopythe.BINfile.

“cd/path/to/folder”Securecopythefilebytyping“scp[user]@manson.eos.ubc.ca:hysplit/wrf_sample/ARLDATA.BIN.“

Page 7: ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide ... · ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab

2b.DownloadandInstallationfromSourceCode

i. UponregisteringwithARL,youshouldreceiveanemailwiththenecessaryinstructionstodownloadthesourcecodeeitherthrough‘svn’or‘wget’,somethinglike:

“wget-r--reject"index.html"-nH--cut-dirs=1--secure-protocol=auto--no-parent--no-check-certificate–user=XXXXX--password=XXXXXhttps://svn.arl.noaa.gov:8443/svn/hysplit/”

ii. Openterminal,changedirectorytothefolderofyourchoice:

“cd~/path/to/folder”

iii. Inputthe‘wget’commandwiththegivenusernameandpassword.Thiswillpromptthedownload.

Inspectthefilebytyping‘ls’ontheterminal.Youshouldseeanewfoldercalled“hysplit”

iv. CheckingDependenciesThis part is rather important for the installation process. Please refer to thefollowinggraphsandmakesurethatyourdependenciesareinstalled.Forthefollowingguide,IwillbeusingMacportsorHomebrewasMacpackagemanager,andpipaspythonpackager.Hereisthelistofdependenciesforthosewhoarecomfortableinchecking/downloadingdependenciesthroughothermeans.

\

b. CheckifXCodeandMacportisinstalled(OSXonly)“xcode-select”“port”Ifnothingpopsuponeithercommand,pleaserefertotheXCode&gfortraninstallationguideonATSC595website

c. VerifyPythonisinstalledbytyping“python--version”

Thecurrentscriptssupportpython2.7andpython3(testedwith3.5)

Compilation(forWRFinputsupport):-netcdflibrary(cxx,fortran)-nco(netcdfoperator)-pythonncopackage

Page 8: ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide ... · ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab

Checksifyouhavepip(pythonmodulemanager)installed.

“pip--version” Ifnot,refertoyourpythonversionfound.Ifyouhavepython2.7,type: “portinstallpy27-pip” Similiarly,python3.4pipwouldbe‘py34-pip’

d. VerifythatnetCDFlibrariesareinstalled:

OnMac,type: “portinstalled|grepnetCDF"Ifyousee“netcdf,netcdf-cxx4,netcdf-fortran”listedonyourterminal,youdonotneedtoinstalladditionalpackages.Otherwise,installanymissingpackagebytyping:

“portinstall[nameofmissingpackage]”OnUbuntuLinux,type:

“aptitudesearch“~i”|grepnetcdf” Ifyousee“libnetcdf-dev”installed,youaregoodtogo. Otherwise,typethefollowinginterminaltoinstallthepackagesneeded.

“sudoapt-getinstalllibnetcdf-dev”

e. Verifythatncolibraryisinstalled:“ncatted”

Ifcommandisnotfound,pleaseinstallncobytyping:“portinstallnco”(Mac)“sudoapt-getinstallnco”(Linux)

f. Finally,verifypythonncopackageisinstalledbytyping:“piplist|grepnco”

Ifnot,installncomodulebytyping: “sudopipinstallnco”*

(mightnotneedsudoinfrontdependingonthefolderpermissionsonyourmachine)

Summary:

Packagename Checkifinstalled,typeinterminal: Shouldsee: InstallCommand:

macports(Maconly) port--version versiontext seegccmacportsetup

xcode(Maconly) xcode--version versiontext seegccmacportsetup

pip pip--version versiontext portinstallpy[version]-pip(eg."py27-pip")

netcdf(mac) portinstalled|grepnetcdf

netcdf

netcdf-cxx4

netcdf-fortran portinstall[packagename]

netcdf(linux) aptitudesearch"~i"|grepnetcdf

libnetcdf-dev

... sudoapt-getinstalllibnetcdf-dev

nco ncatted functioninfo

portinstallnco

(ncoisavailableinhombrew/science)

pythonnco piplist|grepnco nco(version) sudopipinstallnco

Page 9: ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide ... · ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab

v. CompilingHYSPLITsourcecode:a.Updatesourcecode

Runupdate.shbytyping:“shupdate.sh”select“server”,“checkout”

choose‘r’foralltheotheroptions.

b.Checkversion&librarylocations

Inordertocompilethesourcecode,youneedtoknowthefollowinginformation:- nameofthefortrancompilerused- locationofnetcdflibraries(installedearlier)

I. Youshouldknowtheformerifyouhavehadinstalledmodelsbefore(eg. AERMOD)

Type “gfortran--version” “g95--version”

“pg95--version” Interminalandnotethefirstonethatdoesnotgivea“commandnotfound” Ifallofthemarenotfound,pleasereferto“gccMacportsOSXsetupguide”

II. InordertofindthelocationofthenetCDFlibrarypleasedothefollowing.Ifyouhaveinstallednetcdfthroughmacports,type:

“portcontentsnetcdf”ForLinux,type

“dpkg–Lnetcdf”

Pleasenotethelocationsofthefollowingfiles:“netcdf.inc”“libnetcdf.aorlibnetcdff.a”(Alsotakenotewhich.afileyourmachinehas.[1for2f’s(orboth)]Itwillbeimportantlateron)

vi. Compilationprocess

Again,withfinderorterminal,openthenewlydownloaded‘hysplit’directory.Wewillneedtomakechangestothreecompilationfiles.a) In/hysplit/trunk/compile.sh

Opencompile.shwiththetexteditorofyourchoice.

Inline139,lookfor:

Page 10: ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide ... · ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab

ChangeNETLIBtothelocationwhere“libnetcdf.aorlibnetcdff.a”islocated(defaultformacportis/opt/local/lib)ChangeNETINCtothelocationwhere“netcdf.inc”islocated(defaultformacportis/opt/local/include)

Exitthetexteditoruponcompletion

b) In/trunk/data2arl/arw2arl/MakefileOpencompile.shwiththetexteditorofyourchoice.Gotoline20

Ifpreviously,youhave“libnetcdf.a”,orbothofthetwo,makenochangeHowever,ifyouhave“libnetcdff.a”,commentthefirstoneanduncommentthesecondone.

(ifyouhavelibnetcdff.a)

c) Makethesamechangesin/trunk/cmaq/Makefileline23

vii.

Toactuallycompilethecode,youhaveanoptionto‘compile’,or‘install’. Installcreatesaseparatefolderwiththeprogramwhilecompilecreatesthe programinthedownloadeddirectory.

(ifyou’renotshortinspace,I’dsuggestinstall)Toinstall,cdto/path/to/hysplit/,typeinterminal:“shinstall.sh”createanewfolder,“../hysp_new”isokaysay“yes”toupdatesay“yes”toUpdateVersionNumbersay“no”tosoftlinksay“yes”tohardlinkToinstall,cdto/path/to/hysplit/trunk,typeinterminal:“shcompile.sh”

vii. viii.Executetheguiwiththefollowingcommand“(cd~/Hysplit4/working&&./hysplit4.tcl)”

Page 11: ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide ... · ATSC595 Air Pollution Modelling HYSPLIT Model Quick Guide- OSX, Linux Feb. 2016 M. Fung The NOAA Air research lab

WhenIclickonthewindow,thebuttonsbecomedim/unreadable,butjustclickatabrowser window other than the hysplit window, and the buttons should becomereadableagain.

viii. Simpletest:

Inthemenusinterface,click “Trajectory ->QuickStart->RunExample”“Concentration->QuickStart->RunExample”