You are on page 1of 8

GREAT LAKES REGCM4-ROMS RUN

Useful websites for Python scripts:


www.enthought.com/products/epdlibraries.php
www.scipy.org
matplotlib.sourceforge.net
pypi.python.org/pypi/basemap/1.0.1

Powerpoints on ROMS and RegCM4-ROMS:


gforge.ictp.it/gf/user/turuncu/userfiles/

Install PYROMS, netcdf, parallel netcdf 1.2, EMSF 5.2.0rp2, EPD PYTHON, XML XERCES, MPI,
ROMS

Create file similar to /home/graziano/environment.sh and source the file.


source environment.sh

Download ETOP01 netcdf file (“ice surface”) from


http://www.ngdc.noaa.gov/mgg/global/global.html.

Extract a smaller ETOP01 grid, surrounding the region of study, using either NCO or CDO:

ncks –d lon,-94.,-72. –d lat,38.,50. ETOP01_Ice_c_gmt4_all.nc ETOP01_Ice_c_gmt4_all.nc

OR

cdo sellonlatbox,-94,-72,38,50 ETOP01_Ice_c_gmt4_all.nc ETOP01_Ice_c_gmt4_all.nc

vi the python script for creating your ROMS grid, superior.py

Specify center lat,lon of your grid, which affects the projection.


lat_0 = 43.
lon_0 = -85.6

Specify lower left and upper right corners, which surround the entire lake region.
In this case, this box includes all 5 lakes with a little buffer around it. Don’t make it too big
or it will slow the model down.
llcrnrlon= -92.0
llcrnrlat=40.8
urcrnrlon=-74.
urcrnrlat=48.8
Plot map in python.

Type ipython

At first, you need to cut and paste the python script commands into command-line python
to get a satisfactory grid. Later, you can run the entire script as is.

Copy 1st part of superior.py into python to make a map of x,y points.

To draw a map:
run map.drawcoastlines

Find upper-left point 1st and then go counterclockwise, identifying the values of x and y.
This box should surround the entire lakes.
For the Great Lakes, these are the values:
UL: x=19617 y=915744
LL: x=19617 y=30170
LR: x=1356380 y=30170
UR: x=1356380 y=901730

In superior.py, specify these coordinates into Xp and Yp.


Xp=[19617,19617,1356380,1356380]
Yp=[915744,30170,30170,915744]

In python, copy and paste 2nd section from superior.py to generate grid map.

Need to specify # points in N-S direction (Mm) and # points in E-W direction (Lm).
Try these initial values:

Mm=84
Lm=130

Run python commands again.

To check the current x-direction and y-direction resolution of your grid in meters, type:
hgrd.dx
hgrd.dy

Check to see that both are close to 10-km, which was our goal resolution.
If either is not close to 10-km, change Mm and Lm until they are closer to 10-km.

Now, cut and paste next part of superior.py. We are checking for the correct segment,
which represents the Great Lakes. Unfortunately, there are 126 segments total and we
don’t know which represents the Great Lakes. In fact, 3 of them in total represent the lakes,
not one.

These commands will help you figure out which segments are largest and the likely ones
that represent the Great Lakes.
print(nseg)
print(verts)
print(size(verts))
print(nseg, size(verts))

Try different segments to see which captures the lakes. Segment 2 gave the 3 western lakes.
Segment 5 gave Erie. Segment 6 gave Ontario. We need to change the line below so it
includes all 3 segments to get all of the lakes.

In superior.py, change
“if nsseg==4” line and lines below TO:

nseg = 0
hgrd.mask_rho[:] = 0.0
for verts in map.coastsegs:
nseg=nseg+1
if (nseg == 2 or nseg == 5 or nseg == 6):
hgrd.mask_polygon(verts, mask_value=1.0)

(Be careful to get the spacing right in the above commands or it won’t work.)

Cut and paste command:


pyroms.hgrid.edit_mask_mesh(hgrd, proj=map)
show()

Brings up grid map that we can manually edit to remove land points.

To edit map, press “e” and click points to change to specify land points.
Click 5th icon on lower left (with magnifying glass) for zooming.
Close connections between lakes.

Edit superior.py further

Specify subset ETOP01 file name.


Nc=pyroms.io.Dataset(‘ETOP01_Ice_c_gmt4_all.nc’)

Run full python script now:


ipython superior.py
Erie:
LL x=998812 y=260816
LR x=1341660 y=285946
UR x=1332690 y=472628
UL x=993427 y=427752

Elevation:
Superior=180m Huron=176m Ontario=75m Michigan=176m
Erie=174m

So, can use 176m for 4 lakes and 75m for Ontario.

topo_org = topo.copy()
topo = topo_orig-176.0

ix = np.asarray(where ((lats > 43) & (lats < 44.5)))


jx = np.asarray(where ((lons > -80) & (lons < -76.0)))
for i in range(0,ix,shape[-1]):
for j in range(0,jx,shape[-1]):
topo[ix[0,i]][jx[0,j]] = topo_org[ix[0,i]][jx[0,j]]-75.0

Run python script, superior.py again.

It creates GLAKE_grd_v1.nc. Rename the file as version 2.


mv GLAKE_grd_v1.nc GLAKE_grd_v2.nc

mkdir cpl2
cd cpl2
mkdir input
mkdir output

mv GLAKE_grd_v2.nc into cpl2/input/

cd input

Copy the following files into this input directory:


cdl
GLAKE_grd_v2.nc
roms_forc.sh
roms_glue_forc.ncl -> Combines the individual months into one file
roms_split_fld.ncl -> Splits the input files into individual months
roms_forc.ncl
roms_func.ncl
roms_glue_forc.sh
roms_split_fld.sh

Need to merge all of the SRF output files into a single file, GLAKE_SRF.200004-200103.nc

ncrcat ../../cpl/output/GLAKE_SRF.2000040100.nc
../../cpl/output/GLAKE_SRF.2000050100.nc
../../cpl/output/GLAKE_SRF.2000060100.nc
../../cpl/output/GLAKE_SRF.2000070100.nc
../../cpl/output/GLAKE_SRF.2000080100.nc
../../cpl/output/GLAKE_SRF.2000090100.nc
../../cpl/output/GLAKE_SRF.200100100.nc
../../cpl/output/GLAKE_SRF.2000110100.nc
../../cpl/output/GLAKE_SRF.2000120100.nc
../../cpl/output/GLAKE_SRF.2001010100.nc
../../cpl/output/GLAKE_SRF.2001020100.nc ../../cpl/output/GLAKE_SRF.2001030100.nc
GLAKE_SRF.200004-200103.nc

vi roms_forc.ncl

prefix = “GLAKE”

fin=”GLAKE_grd_v2.nc”

cycle_length = 365

Change the epoc if-then loop to the following:

epoc = “days since 2000-04-01 00:00:00”

durl = ”.”

Edit the “if (dname….) loop” twice, regarding SRF, in script to:
url = durl+”/GLAKE_SRF.200004-200103.nc”
Don’t worry about the RAD files because the model won’t use them.

Comment out “varz =” lines.

vi roms_forc.sh (interpolates 9 forcing variables and creates GLAKE_forcing*nc monthly


files)
First we prepare for year 2000.

for yy in `seq 2000 2000`

for mm in 04 05 06 07 08 09 10 11 12
(since we want to run April 2000 – December 2000)

Specify GLAKE_forcing_${str}.nc

Run script
./roms_forc.sh
(This script will run roms_forc.ncl)

Then we’ll prepare for year 2001.

Then vi roms_forc.sh again

for yy in `seq 2001 2001`

for mm in 01 02 03
(Since we want to run Jan 2001-Mar 2001)

Run script again


./roms_forc.sh

vi roms_split_fld.sh

Change file to “GLAKE_forcing_*

./roms_split_fld.sh
(Runs roms_split_fld.ncl)

This will create one nc file per variable per month.


e.g. GLAKE_forcing_rain_200004.nc

vi roms_glue_forc.sh

prefix=”GLAKE_forcing”

List of variables should begin with lwrad, etc (remove two variables for clouds and
radiation before it).
suffix=”200”

./roms_glue_forc.sh
(Runs roms_glue_forc.ncl)

Merges all forcing files into one file


e.g. GLAKE_forcing_Pair_200.nc

In cpl2 directory,

cp ../cpl/regcm.in_LAKESUP20km_16-05-12-09:57 regcm.in_LAKESUP20km

cp ../cpl/glake.in .
cp ../cpl/ice.in .
cp ../cpl/varinfo.dat .
cp ../cpl/regcm.job .
cp ../cpl/regcm.rc .

We’ll use the same executable as a previous run, so link to those binaries.
ln –s ../cpl/src/RegCM-4.3-rc7/Bin .

Link the ICBCs, domain, and SSTs from the previous run so we can use them again.
cd input
ln –s ../../cpl/input/GLAKE_ICBC.200* .
ln –s ../../cpl/input/GLAKE_DOMAIN000.nc .
ln –s ../../cpl/input/GLAKE_SST.nc .

cd ..
(in cpl2 dir)

vi regcm.in_LAKESUP20km

lakemod = 0

dirter=’/home/mnotaro/cpl2/input’
dirglob=’/home/mnotaro/cpl2/input’
dirout=’/home/mnotaro/cpl2/output’

ncdump –h GLAKE_grd_v2.nc
xi_rho=129, eta_rho=83
vi glake.in

Mm == 81 (2 less than in ncdump of forcing file)


Lm == 127 (2 less than in ncdump of forcing file)

NNREC == 0 (spinup, not a restart)


LcycleRST == F (write restart each day and file continues to grow)
LDEFOUT == T (daily history files)

GRDNAME == input/GLAKE_grd_v2.nc
ININAME == /dev/null (we provided the initial conditions)

vi regcm.job
PBS_O_WORKDIR=/home/mnotaro/cpl2

Submit job:
qsub regcm.job

Check regcmout.txt to check the progress of the run.

You might also like