Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Carl Schreck
NASA Kelvin Waves
Commits
df1f98d0
Commit
df1f98d0
authored
Mar 18, 2016
by
Carl Schreck
Browse files
Switched sub.draw_lag_hov.ncl for pouch-relative
parent
67e5c279
Changes
4
Hide whitespace changes
Inline
Side-by-side
lib/sub.draw_lag_hov.ncl
View file @
df1f98d0
...
...
@@ -6,16 +6,6 @@
; Description: Draw composite hovmoller based on a Kelvin-TC lag
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"
load "$CJS_NCL_LIB/print_clock.ncl"
undef ( "draw_lag_hov" )
function draw_lag_hov( \
...
...
@@ -47,7 +37,7 @@ begin ; draw_lag_hov
stormMaxLat = 00
waveMinLat = -10
waveMaxLat = 00
if(
any( i_shdVar.eq.(/ "u850", "u200" /) )
) then
if(
str_get_cols( i_shdVar,0,0).eq."u"
) then
shdMinLat = -10
shdMaxLat = 05
else
...
...
@@ -60,7 +50,7 @@ begin ; draw_lag_hov
stormMaxLat = 20
waveMinLat = 00
waveMaxLat = 10
if(
any( i_shdVar.eq.(/ "u850", "u200" /) )
) then
if(
str_get_cols( i_shdVar,0,0).eq."u"
) then
shdMinLat = -05
shdMaxLat = 10
else
...
...
@@ -69,25 +59,25 @@ begin ; draw_lag_hov
end if
end if
nTests = 1
0000
pThresh = 0.
95
nTests = 1
pThresh = 0.
0
minLag = -12
maxLag = 8
minLag = -12
.
maxLag = 8
.
deltaLag = 0.25
nLag = 1 + round( tofloat( maxLag - minLag ) / deltaLag, 3 )
lag = minLag + deltaLag * ispan( 0, nLag-1, 1 )
if( i_shdVar.eq."rain" ) then
shdLevels = ispan( -4, 4, 1 ) * 0.1
shdPath = "/home/carl/data/trmm/trmm3b42.
anom.
nc"
shdPath = "/home/carl/data/trmm/trmm3b42.nc"
else
if( i_shdVar.eq."notc" ) then
i_shdVar = "rain"
shdLevels = ispan( -4, 4, 1 ) * 0.1
shdPath = "/home/carl/data/trmm/notc500/trmm3b42.
anom.
notc500.nc"
shdPath = "/home/carl/data/trmm/notc500/trmm3b42.notc500.nc"
else
shdPath = "/home/carl/data/merra/
anom
/" + i_shdVar + ".
anom
.nc"
shdPath = "/home/carl/data/merra/
total
/" + i_shdVar + ".
total
.nc"
end if
end if
if( ( i_shdVar.eq."epv850" ).or.( i_shdVar.eq."epv700" ) ) then
...
...
@@ -106,10 +96,7 @@ begin ; draw_lag_hov
if( i_shdVar.eq."t850" ) then
shdLevels = ispan( -4, 4, 1 ) * 0.2
end if
if( i_shdVar.eq."u200" ) then
shdLevels = ispan( -4, 4, 1 ) * 1
end if
if( i_shdVar.eq."u850" ) then
if( str_get_cols( i_shdVar,0,0).eq."u" ) then
shdLevels = ispan( -4, 4, 1 ) * 1.00
end if
if( i_shdVar.eq."v200" ) then
...
...
@@ -136,12 +123,17 @@ begin ; draw_lag_hov
compLag = stormWaveData@allCrestLag(crestInd)
compLon = stormWaveData@lon(stormInd)
compLat = stormWaveData@lat(stormInd)
compDates = stormWaveData@time(stormInd) - compLag
compDates = stormWaveData@time(stormInd)
;
- compLag
compDates@units = stormWaveData@timeUnits
centerLag = dim_median( compLag )
centerLon = dim_median( compLon )
centerLat = dim_median( compLat )
minLag = minLag - tofloat(centerLag)
maxLag = maxLag - tofloat(centerLag)
centerLag = 0
if( centerLon.gt.180 ) then
centerLon = centerLon - 360
end if
...
...
@@ -170,6 +162,11 @@ begin ; draw_lag_hov
delete(inData2d)
printMinMax( shdData, True )
if( isatt( i_res, "waveSpeed" ).and. \
( str_get_cols( i_shdVar, 0,0 ).eq."u" ) ) then
shdData = shdData - i_res@waveSpeed
end if
print_clock( "Compositing" )
inData3d = read_xyt( cntPath, waveName, miss, waveMinLat, waveMaxLat, miss, miss )
inData2d = dim_avg_n_Wrap( inData3d, 1 )
...
...
@@ -334,7 +331,18 @@ begin ; draw_lag_hov
genSymb = gsn_add_text( io_wks, retVal, "~F37~p", centerLon, centerLag, txRes )
end if
if( isatt( i_res, "waveSpeed" ) ) then
lineRes = True
lineRes@gsLineDashPattern = 2
waveT0 = minLag
waveX0 = centerLon + i_res@waveSpeed * minLag * 86400 / 111000
waveTn = maxLag
waveXn = centerLon + i_res@waveSpeed * maxLag * 86400 / 111000
retVal@$unique_string("")$ = \
gsn_add_polyline( io_wks, retVal, (/ waveX0, waveXn /), \
(/ waveT0, waveTn /), lineRes )
end if
return(retVal)
end; draw_lag_hov
pouches/bsub_hov.sh
0 → 100755
View file @
df1f98d0
#!/bin/bash --login
if
[
-z
"
$1
"
]
;
then
QUEUE
=
`
pick_queue
`
else
QUEUE
=
$1
fi
echo
$QUEUE
NCL_DIR
=
`
pwd
`
LOG_DIR
=
$NCL_DIR
/log
mkdir
-p
$LOG_DIR
GEN_NOT_RI
=
true
if
$GEN_NOT_RI
then
STORM_TYPE
=
genesis
ALL_TARGET_BASIN
=(
0 3 2 5 6 4
)
ALL_TARGET_LAG
=(
2 3 0 2 3 1
)
else
STORM_TYPE
=
strong
ALL_TARGET_BASIN
=(
0 0 3 2 6 6 4
)
ALL_TARGET_LAG
=(
-4
3
-3
1 1 5
-2
)
fi
NCL_SCRIPT
=
multi_lag_hov
for
((
i
=
0
;
i <
${#
ALL_TARGET_BASIN
[@]
}
;
i++
))
do
TARGET_BASIN
=
${
ALL_TARGET_BASIN
[
$i
]
}
TARGET_LAG
=
${
ALL_TARGET_LAG
[
$i
]
}
JOB_NAME
=
"
$NCL_SCRIPT
"
_
"
$STORM_TYPE
"
_
"
$VAR_NAME
"
_
"
$TARGET_BASIN
"
_
"
$TARGET_LAG
"
echo
$JOB_NAME
`
date
`
NCL_OPTION
=
"stormType=
\"
$STORM_TYPE
\"
shdVar=
\"
$VAR_NAME
\"
targetBasin=
$TARGET_BASIN
stormMinLag=
$TARGET_LAG
"
echo
$NCL_OPTION
`
date
`
LOG_FILE
=
$LOG_DIR
/
$JOB_NAME
.log
rm
$LOG_FILE
bsub
\
-J
$JOB_NAME
\
-N
\
-o
$LOG_FILE
\
-q
$QUEUE
\
-n
1
-W
1:00
\
-sp
50
\
~/template/run_ncl.sh
$NCL_DIR
$NCL_SCRIPT
"
$NCL_OPTION
"
done
pouches/bsub_map.sh
View file @
df1f98d0
...
...
@@ -12,15 +12,16 @@ LOG_DIR=$NCL_DIR/log
mkdir
-p
$LOG_DIR
STORM_TYPE
=
genesis
ALL_TARGET_BASIN
=(
0 3 2 5 6 4
)
#ALL_TARGET_BASIN=( 0 3 2 5 6 4 )
ALL_TARGET_BASIN
=(
0 3
)
ALL_TARGET_LAG
=(
2 3 0 2 3 1
)
ALL_WAVE_SPEED
=(
4.5 4.5
4.5 3.2 3.2 3.9
)
ALL_WAVE_SPEED
=(
3.0 3.0
4.5 3.2 3.2 3.9
)
#ALL_WAVE_SPEED=( 0.0 0.0 0.0 0.0 0.0 0.0 )
#for VAR_NAME in vort ow u epv
for
VAR_NAME
in
u
do
for
LEVEL
in
500 400
for
LEVEL
in
850 600
500 400
do
NCL_SCRIPT
=
"pouch_lag_map"
for
((
i
=
0
;
i <
${#
ALL_TARGET_BASIN
[@]
}
;
i++
))
...
...
pouches/pouch_lag_hov.ncl
0 → 100644
View file @
df1f98d0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; storm_phase_hov.ncl
; Carl Schreck (cjschrec@ncsu.edu)
; February 2014
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Description: Draw a Hovmoller composite for storms in a given phase of a wave
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
load "$CJS_NCL_LIB/print_clock.ncl"
load "$CJS_NCL_LIB/lib.ibtracs.ncl"
load "$CJS_NCL_LIB/lib.array.ncl"
load "$CJS_NCL_LIB/lib.composites.ncl"
load "/home/carl/projects/kelvin/lib/sub.match_storm_wave.ncl"
load "/home/carl/projects/kelvin/lib/sub.match_storm_crest.ncl"
load "/home/carl/projects/kelvin/lib/sub.draw_lag_hov.ncl"
begin ; main
print_clock( "Here we go!" )
; These are some parameters that could be useful to have up top
if( .not.isvar("stormMinLag") ) then
stormMinLag = 2
end if
if( .not.isvar("stormMaxLag") ) then
stormMaxLag = stormMinLag + 0.75
end if
if( .not.isvar("targetBasin") ) then
targetBasin = 0
end if
if( .not.isvar("stormType") ) then
stormType = "genesis"
end if
if( .not.isvar("waveSpeed") ) then
waveSpeed = -3
else
waveSpeed = -waveSpeed
end if
shdVar := (/ "rain", "u850", "u400" /)
plotType = "png"
plotDpi = 200
fontHeightF = 0.02
txString = ibt_basin_name( targetBasin, True ) + "_" \
+ stormType + "_" + stormMinLag + "_" + waveSpeed + "_hov_multi"
plotName = "figures/" + txString
print_clock( txString )
; ...allows png or gif to work
if( ( plotType.eq."png" ).or.( plotType.eq."gif" ) ) then
plotTypeLocal = "eps"
else
plotTypeLocal = plotType
end if
; ...open the workstation
wks = gsn_open_wks( plotTypeLocal, plotName )
res = True
res@vpWidthF = 0.4
res@fontHeightF = fontHeightF
res@lbTitlePosition = "Bottom"
res@waveSpeed = waveSpeed
plots = new( dimsizes(shdVar), graphic )
do plotCounter = 0, dimsizes(plots)-1
res@gsnLeftString = inttochar(97+plotCounter) + ") " \
+ str_capital( shdVar(plotCounter) )
res@tmYLLabelsOn = plotCounter.eq.0
if( .not.res@tmYLLabelsOn ) then
res@tiYAxisString = ""
end if
plots(plotCounter) = draw_lag_hov( wks, shdVar(plotCounter), stormType, \
stormMinLag, stormMaxLag, targetBasin, res )
end do
txString = ibt_basin_name( targetBasin, False ) \
+ " (" + plots@nSamp + " storms)"
txRes = True
txRes@txFontHeightF = fontHeightF
gsn_text_ndc( wks, txString, 0.5, 0.83, txRes )
attRes = True
attRes@gsnPaperOrientation = "portrait"
attached = gsn_attach_plots( plots(0), plots(1:), attRes, attRes )
yMajorLength = 0.
yMinorLength = 0.
getvalues plots(0)
"tmYLMajorLengthF" : yMajorLength
"tmYLMinorLengthF" : yMinorLength
end getvalues
do plotCounter = 0, dimsizes(plots)-1
setvalues plots(plotCounter)
"tmYLOn" : True
"tmYROn" : True
end setvalues
if( plotCounter.gt.0 ) then
setvalues plots(plotCounter)
"tmYLMajorOutwardLengthF" : 0.5*yMajorLength
"tmYLMinorOutwardLengthF" : 0.5*yMinorLength
end setvalues
end if
end do
draw(plots(0))
frame(wks)
print_clock( "Convert the image, if necessary" )
delete(wks)
if( isStrSubset( plotType, "png" ).or.isStrSubset( plotType, "gif" ) ) then
system( "convert -trim -border 5x5 -bordercolor white " \
+ "+repage -density " + plotDpi + " " \\
+ plotName + ".eps " + plotName + "." + plotType )
if( .not.isStrSubset( plotType, "e" ) ) then
; system( "rm -f " + plotName + ".eps" )
end if
end if
print_clock( "Thank you, come again." )
end; main
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment