<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Thanks Adam<br>
<br>
Let's see what the developers say about the axis reverse problem. It
is possible that I have inadvertently turned up a bug in
gsn_csm_contour.<br>
<br>
For the second problem, I have now fixed it by replacing<br>
gsn_coordinates(wks,plot_TdegC_line90,T_degC,pmres)<br>
with<br>
dum =
gsn_add_polymarker(wks,plot_TdegC_line90,Station,Depthm,pmres)<br>
See
<a class="moz-txt-link-rfc2396E" href="https://my.pcloud.com/publink/show?code=XZczU17ZNgahwVF0fgjf0cz8iHoGSFKTNObV"><https://my.pcloud.com/publink/show?code=XZczU17ZNgahwVF0fgjf0cz8iHoGSFKTNObV></a><br>
<br>
I was thinking I could use gsn_coordinates because the variable I am
plotting had lat, lon coordinates, but of course you are right that
there is nowhere to plot these on a station by depth plot.<br>
<br>
Thanks for your help.<br>
Sam<br>
<br>
<div class="moz-cite-prefix">On 19/09/18 08:53, Adam Phillips wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CACvWuqBwnyoxx7jM3wSk_DKCcSSWs05qChe-q6+ccFmGjQjDSQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<div dir="ltr">Hi Sam,
<div>Testing out your script here I am getting the same weird
behavior with the issues you reported in 1), in that
trXReverse and/or trYReverse cause the filled contours to
disappear, and I could not figure a way for this behavior to
stop. A NCL developer will have to speak as to why that is the
case. </div>
<div><br>
</div>
<div>With regards to your gsn_coordinates, I think the
gsn_coordinates call isn't working as you are plotting a depth
x station plot using gsn_csm_contour, and then you are wanting
to overlay the lat/lon arrays denoting your station locations.
As latitudes/longitudes are not the axes of your contour plot,
there's nowhere to put the station locations. </div>
<div><br>
</div>
<div>I've attached the data file and script, as well as the
resulting image.</div>
<div>Adam</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Sun, Sep 16, 2018 at 12:07 AM Sam McClatchie
<<a href="mailto:smcclatchie@fishocean.info"
moz-do-not-send="true">smcclatchie@fishocean.info</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> Colleagues<br>
<br>
I have two questions with regard to plotting a slice of data
using 1-d array variables (temperature, depth and station):<br>
<br>
1) I do not seem to be using the trYReverse and trXReverse
resources correctly because my plot fails to show the filled
contours when I uncomment these lines (see below). It plots
fine before trying to reverse the axes.<br>
<br>
2) I have failed to overlay the sample points using
gsn_coordinates with a variable that has lat/ lon
attributes. I used this method successfully when plotting
surfaces rather than slices. My code does not modify the
DrawOrder anywhere, so I assume the default PostDraw order.<br>
<br>
Here is my code:<br>
==== snip <br>
fname =
"../data/CalCOFI_merged_line90_section_temperature.txt"<br>
lines =
asciiread(fname,-1,"string")<br>
lines@_FillValue = -999<br>
lines =
str_sub_str(lines,",-999,",",lines@_FillValue,")<br>
Depthm =
tofloat(str_get_field(lines(1:),1," "))<br>
T_degC =
tofloat(str_get_field(lines(1:),2," "))<br>
T_degC@lat1d = tofloat(str_get_field(lines(1:),3,"
")) ; Attach as lat1d, lon1d<br>
T_degC@lon1d = tofloat(str_get_field(lines(1:),4,"
")) ; for plotting later<br>
Station =
tofloat(str_get_field(lines(1:),6," "))<br>
<br>
; plot options<br>
res@cnLevelSelectionMode = "ManualLevels"<br>
res@cnMinLevelValF = 6.<br>
res@cnMaxLevelValF = 14.<br>
res@cnLevelSpacingF = 1.0 ; contour spacing<br>
res@cnFillOn = True<br>
res@tiMainString = "CalCOFI line 90
section"<br>
res@tiYAxisString = "Depth" ;
y-axis title<br>
res@tiXAxisString = "Station" ;
x-axis title<br>
; use a cmocean colormap<br>
res@cnFillPalette = "cmocean_thermal"<br>
res@sfXArray = Station<br>
res@sfYArray = Depthm<br>
<br>
; res@trYReverse = True ; reverses
y-axis<br>
; res@trXReverse = True ; reverses
x-axis<br>
plot_TdegC_line90 =
gsn_csm_contour(wks,T_degC,res)<br>
<br>
; add stations<br>
gsn_coordinates(wks,plot_TdegC_line90,T_degC,pmres)<br>
<br>
===== snip<br>
<br>
And here is a snippet of my data <br>
<br>
"Depthm" "T_degC" "Lat_Dec" "Lon_Dec" "Rpt_Line" "Rpt_Sta"
"Cruise" "Year" "Month"<br>
0 13.95 33.483333 -117.77 90 28 201203 2012 3<br>
2 13.95 33.483333 -117.77 90 28 201203 2012 3<br>
5 13.94 33.483333 -117.77 90 28 201203 2012 3<br>
10 13.68 33.483333 -117.77 90 28 201203 2012 3<br>
11 13.39 33.483333 -117.77 90 28 201203 2012 3<br>
20 11.89 33.483333 -117.77 90 28 201203 2012 3<br>
30 11.34 33.483333 -117.77 90 28 201203 2012 3<br>
41 10.91 33.483333 -117.77 90 28 201203 2012 3<br>
50 10.6 33.483333 -117.77 90 28 201203 2012 3<br>
51 10.55 33.483333 -117.77 90 28 201203 2012 3<br>
60 10.45 33.483333 -117.77 90 28 201203 2012 3<br>
0 13.99 33.418333 -117.898333 90 30 201203 2012 3<br>
2 13.99 33.418333 -117.898333 90 30 201203 2012 3<br>
10 13.93 33.418333 -117.898333 90 30 201203 2012 3<br>
11 13.89 33.418333 -117.898333 90 30 201203 2012 3<br>
11 13.89 33.418333 -117.898333 90 30 201203 2012 3<br>
20 13.74 33.418333 -117.898333 90 30 201203 2012 3<br>
30 13.22 33.418333 -117.898333 90 30 201203 2012 3<br>
31 12.79 33.418333 -117.898333 90 30 201203 2012 3<br>
40 12.17 33.418333 -117.898333 90 30 201203 2012 3<br>
50 11.25 33.418333 -117.898333 90 30 201203 2012 3<br>
60 10.75 33.418333 -117.898333 90 30 201203 2012 3<br>
70 10.59 33.418333 -117.898333 90 30 201203 2012 3<br>
75 10.4 33.418333 -117.898333 90 30 201203 2012 3<br>
85 10.26 33.418333 -117.898333 90 30 201203 2012 3<br>
100 10.1 33.418333 -117.898333 90 30 201203 2012 3<br>
119 9.93 33.418333 -117.898333 90 30 201203 2012 3<br>
125 9.76 33.418333 -117.898333 90 30 201203 2012 3<br>
141 9.56 33.418333 -117.898333 90 30 201203 2012 3<br>
150 9.48 33.418333 -117.898333 90 30 201203 2012 3<br>
170 9.32 33.418333 -117.898333 90 30 201203 2012 3<br>
200 9.26 33.418333 -117.898333 90 30 201203 2012 3<br>
201 9.22 33.418333 -117.898333 90 30 201203 2012 3<br>
231 8.84 33.418333 -117.898333 90 30 201203 2012 3<br>
250 8.72 33.418333 -117.898333 90 30 201203 2012 3<br>
270 8.61 33.418333 -117.898333 90 30 201203 2012 3<br>
300 8.57 33.418333 -117.898333 90 30 201203 2012 3<br>
320 8.21 33.418333 -117.898333 90 30 201203 2012 3<br>
381 7.74 33.418333 -117.898333 90 30 201203 2012 3<br>
400 7.54 33.418333 -117.898333 90 30 201203 2012 3<br>
441 6.98 33.418333 -117.898333 90 30 201203 2012 3<br>
500 6.57 33.418333 -117.898333 90 30 201203 2012 3<br>
516 6.46 33.418333 -117.898333 90 30 201203 2012 3<br>
0 13.9 33.25 -118.255 90 35 201203 2012 3<br>
2 13.9 33.25 -118.255 90 35 201203 2012 3<br>
10 13.88 33.25 -118.255 90 35 201203 2012 3<br>
10 13.88 33.25 -118.255 90 35 201203 2012 3<br>
20 13.01 33.25 -118.255 90 35 201203 2012 3<br>
30 11.66 33.25 -118.255 90 35 201203 2012 3<br>
40 11.2 33.25 -118.255 90 35 201203 2012 3<br>
50 10.79 33.25 -118.255 90 35 201203 2012 3<br>
51 10.73 33.25 -118.255 90 35 201203 2012 3<br>
60 10.58 33.25 -118.255 90 35 201203 2012 3<br>
70 10.46 33.25 -118.255 90 35 201203 2012 3<br>
75 10.38 33.25 -118.255 90 35 201203 2012 3<br>
86 10.23 33.25 -118.255 90 35 201203 2012 3<br>
100 10.06 33.25 -118.255 90 35 201203 2012 3<br>
120 9.82 33.25 -118.255 90 35 201203 2012 3<br>
125 9.82 33.25 -118.255 90 35 201203 2012 3<br>
140 9.8 33.25 -118.255 90 35 201203 2012 3<br>
150 9.64 33.25 -118.255 90 35 201203 2012 3<br>
169 9.25 33.25 -118.255 90 35 201203 2012 3<br>
199 8.96 33.25 -118.255 90 35 201203 2012 3<br>
200 8.95 33.25 -118.255 90 35 201203 2012 3<br>
231 8.6 33.25 -118.255 90 35 201203 2012 3<br>
250 8.3 33.25 -118.255 90 35 201203 2012 3<br>
270 8.16 33.25 -118.255 90 35 201203 2012 3<br>
300 7.89 33.25 -118.255 90 35 201203 2012 3<br>
320 7.79 33.25 -118.255 90 35 201203 2012 3<br>
370 7.35 33.25 -118.255 90 35 201203 2012 3<br>
0 13.92 33.183333 -118.391667 90 37 201203 2012 3<br>
2 13.92 33.183333 -118.391667 90 37 201203 2012 3<br>
10 13.93 33.183333 -118.391667 90 37 201203 2012 3<br>
20 13.64 33.183333 -118.391667 90 37 201203 2012 3<br>
21 13.56 33.183333 -118.391667 90 37 201203 2012 3<br>
30 13.38 33.183333 -118.391667 90 37 201203 2012 3<br>
41 12.89 33.183333 -118.391667 90 37 201203 2012 3<br>
50 11.61 33.183333 -118.391667 90 37 201203 2012 3<br>
51 11.47 33.183333 -118.391667 90 37 201203 2012 3<br>
60 11.13 33.183333 -118.391667 90 37 201203 2012 3<br>
71 10.71 33.183333 -118.391667 90 37 201203 2012 3<br>
75 10.64 33.183333 -118.391667 90 37 201203 2012 3<br>
85 10.46 33.183333 -118.391667 90 37 201203 2012 3<br>
100 10.07 33.183333 -118.391667 90 37 201203 2012 3<br>
122 9.76 33.183333 -118.391667 90 37 201203 2012 3<br>
125 9.7 33.183333 -118.391667 90 37 201203 2012 3<br>
141 9.6 33.183333 -118.391667 90 37 201203 2012 3<br>
150 9.47 33.183333 -118.391667 90 37 201203 2012 3<br>
170 9.12 33.183333 -118.391667 90 37 201203 2012 3<br>
200 8.84 33.183333 -118.391667 90 37 201203 2012 3<br>
201 8.83 33.183333 -118.391667 90 37 201203 2012 3<br>
231 8.7 33.183333 -118.391667 90 37 201203 2012 3<br>
250 8.5 33.183333 -118.391667 90 37 201203 2012 3<br>
270 8.27 33.183333 -118.391667 90 37 201203 2012 3<br>
300 7.96 33.183333 -118.391667 90 37 201203 2012 3<br>
321 7.75 33.183333 -118.391667 90 37 201203 2012 3<br>
381 7.19 33.183333 -118.391667 90 37 201203 2012 3<br>
400 7.09 33.183333 -118.391667 90 37 201203 2012 3<br>
439 6.76 33.183333 -118.391667 90 37 201203 2012 3<br>
500 6.34 33.183333 -118.391667 90 37 201203 2012 3<br>
515 6.28 33.183333 -118.391667 90 37 201203 2012 3<br>
0 13.97 32.918333 -118.938333 90 45 201203 2012 3<br>
2 13.97 32.918333 -118.938333 90 45 201203 2012 3<br>
10 13.95 32.918333 -118.938333 90 45 201203 2012 3<br>
10 13.95 32.918333 -118.938333 90 45 201203 2012 3<br>
<br>
I have searched the examples and the maillist, but clearly
have missed something.<br>
<br>
Best fishes<br>
Sam<br>
<div class="m_183099474800055316moz-signature">-- <br>
Sam McClatchie (fisheries oceanographer)<br>
& Elena Turin (accounting & auditing)<br>
FishOcean Enterprises<br>
38 Upland Rd, Huia, Auckland 0604, New Zealand<br>
cell: 027 752 8495<br>
<span style="text-decoration:underline"><a
href="http://www.fishocean.info" target="_blank"
moz-do-not-send="true">Internet</a></span><br>
<img style="width:150px;height:149px" alt=""
src="cid:part2.C2A7733C.9FBE6049@fishocean.info"
moz-do-not-send="true"><br>
<br>
"The time has come", the tui said,<br>
"to talk of many things:<br>
Of songs - and ferns - and flowering flax,<br>
of Pukekos and dreams ..."<br>
<br>
(not Lewis Carroll) </div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank"
moz-do-not-send="true">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div>
<div><span><font color="#888888">Adam Phillips
<br>
</font></span></div>
<span><font color="#888888">Associate
Scientist, </font></span><span><font
color="#888888">Climate and Global
Dynamics Laboratory, NCAR<br>
</font></span></div>
</div>
<div><span><font color="#888888"><a
href="http://www.cgd.ucar.edu/staff/asphilli/"
target="_blank" moz-do-not-send="true">www.cgd.ucar.edu/staff/asphilli/</a>
</font></span><span><font color="#888888">303-497-1726
</font></span></div>
<span></span>
<div>
<div><span><font color="#888888"><br>
</font></span>
<div><span></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<title>email signature</title>
Sam McClatchie (fisheries oceanographer)<br>
& Elena Turin (accounting & auditing)<br>
FishOcean Enterprises<br>
38 Upland Rd, Huia, Auckland 0604, New Zealand<br>
cell: 027 752 8495<br>
<span style="text-decoration: underline;"><a
href="http://www.fishocean.info">Internet</a></span><br>
<img style="width: 150px; height: 149px;" alt=""
src="cid:part8.C15C795F.36687412@fishocean.info"><br>
<br>
"The time has come", the tui said,<br>
"to talk of many things:<br>
Of songs - and ferns - and flowering flax,<br>
of Pukekos and dreams ..."<br>
<br>
(not Lewis Carroll)
</div>
</body>
</html>