[ncl-talk] gsn_csm_contour/ reversing x and y-axes/ overlay sampled points

Adam Phillips asphilli at ucar.edu
Tue Sep 18 14:53:32 MDT 2018


Hi Sam,
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.

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.

I've attached the data file and script, as well as the resulting image.
Adam

On Sun, Sep 16, 2018 at 12:07 AM Sam McClatchie <smcclatchie at fishocean.info>
wrote:

> Colleagues
>
> I have two questions with regard to plotting a slice of data using 1-d
> array variables (temperature, depth and station):
>
> 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.
>
> 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.
>
> Here is my code:
> ==== snip
>  fname                      =
> "../data/CalCOFI_merged_line90_section_temperature.txt"
>       lines                    = asciiread(fname,-1,"string")
>       lines at _FillValue         = -999
>       lines                    = str_sub_str(lines,",-999,",",lines@
> _FillValue,")
>       Depthm               = tofloat(str_get_field(lines(1:),1," "))
>       T_degC                = tofloat(str_get_field(lines(1:),2," "))
>       T_degC at lat1d     = tofloat(str_get_field(lines(1:),3," "))  ;
> Attach as lat1d, lon1d
>       T_degC at lon1d    = tofloat(str_get_field(lines(1:),4," "))  ; for
> plotting later
>       Station                 = tofloat(str_get_field(lines(1:),6," "))
>
>       ; plot options
>       res at cnLevelSelectionMode = "ManualLevels"
>       res at cnMinLevelValF            = 6.
>       res at cnMaxLevelValF           = 14.
>       res at cnLevelSpacingF          = 1.0 ; contour spacing
>       res at cnFillOn                        = True
>       res at tiMainString                 = "CalCOFI line 90 section"
>       res at tiYAxisString                 = "Depth"       ; y-axis title
>       res at tiXAxisString                = "Station"       ; x-axis title
>       ; use a cmocean colormap
>       res at cnFillPalette        = "cmocean_thermal"
>       res at sfXArray             = Station
>       res at sfYArray             = Depthm
>
>       ; res at trYReverse         = True          ; reverses y-axis
>       ; res at trXReverse         = True          ; reverses x-axis
>       plot_TdegC_line90        = gsn_csm_contour(wks,T_degC,res)
>
>       ; add stations
>       gsn_coordinates(wks,plot_TdegC_line90,T_degC,pmres)
>
> ===== snip
>
> And here is a snippet of my data
>
> "Depthm" "T_degC" "Lat_Dec" "Lon_Dec" "Rpt_Line" "Rpt_Sta" "Cruise" "Year"
> "Month"
> 0 13.95 33.483333 -117.77 90 28 201203 2012 3
> 2 13.95 33.483333 -117.77 90 28 201203 2012 3
> 5 13.94 33.483333 -117.77 90 28 201203 2012 3
> 10 13.68 33.483333 -117.77 90 28 201203 2012 3
> 11 13.39 33.483333 -117.77 90 28 201203 2012 3
> 20 11.89 33.483333 -117.77 90 28 201203 2012 3
> 30 11.34 33.483333 -117.77 90 28 201203 2012 3
> 41 10.91 33.483333 -117.77 90 28 201203 2012 3
> 50 10.6 33.483333 -117.77 90 28 201203 2012 3
> 51 10.55 33.483333 -117.77 90 28 201203 2012 3
> 60 10.45 33.483333 -117.77 90 28 201203 2012 3
> 0 13.99 33.418333 -117.898333 90 30 201203 2012 3
> 2 13.99 33.418333 -117.898333 90 30 201203 2012 3
> 10 13.93 33.418333 -117.898333 90 30 201203 2012 3
> 11 13.89 33.418333 -117.898333 90 30 201203 2012 3
> 11 13.89 33.418333 -117.898333 90 30 201203 2012 3
> 20 13.74 33.418333 -117.898333 90 30 201203 2012 3
> 30 13.22 33.418333 -117.898333 90 30 201203 2012 3
> 31 12.79 33.418333 -117.898333 90 30 201203 2012 3
> 40 12.17 33.418333 -117.898333 90 30 201203 2012 3
> 50 11.25 33.418333 -117.898333 90 30 201203 2012 3
> 60 10.75 33.418333 -117.898333 90 30 201203 2012 3
> 70 10.59 33.418333 -117.898333 90 30 201203 2012 3
> 75 10.4 33.418333 -117.898333 90 30 201203 2012 3
> 85 10.26 33.418333 -117.898333 90 30 201203 2012 3
> 100 10.1 33.418333 -117.898333 90 30 201203 2012 3
> 119 9.93 33.418333 -117.898333 90 30 201203 2012 3
> 125 9.76 33.418333 -117.898333 90 30 201203 2012 3
> 141 9.56 33.418333 -117.898333 90 30 201203 2012 3
> 150 9.48 33.418333 -117.898333 90 30 201203 2012 3
> 170 9.32 33.418333 -117.898333 90 30 201203 2012 3
> 200 9.26 33.418333 -117.898333 90 30 201203 2012 3
> 201 9.22 33.418333 -117.898333 90 30 201203 2012 3
> 231 8.84 33.418333 -117.898333 90 30 201203 2012 3
> 250 8.72 33.418333 -117.898333 90 30 201203 2012 3
> 270 8.61 33.418333 -117.898333 90 30 201203 2012 3
> 300 8.57 33.418333 -117.898333 90 30 201203 2012 3
> 320 8.21 33.418333 -117.898333 90 30 201203 2012 3
> 381 7.74 33.418333 -117.898333 90 30 201203 2012 3
> 400 7.54 33.418333 -117.898333 90 30 201203 2012 3
> 441 6.98 33.418333 -117.898333 90 30 201203 2012 3
> 500 6.57 33.418333 -117.898333 90 30 201203 2012 3
> 516 6.46 33.418333 -117.898333 90 30 201203 2012 3
> 0 13.9 33.25 -118.255 90 35 201203 2012 3
> 2 13.9 33.25 -118.255 90 35 201203 2012 3
> 10 13.88 33.25 -118.255 90 35 201203 2012 3
> 10 13.88 33.25 -118.255 90 35 201203 2012 3
> 20 13.01 33.25 -118.255 90 35 201203 2012 3
> 30 11.66 33.25 -118.255 90 35 201203 2012 3
> 40 11.2 33.25 -118.255 90 35 201203 2012 3
> 50 10.79 33.25 -118.255 90 35 201203 2012 3
> 51 10.73 33.25 -118.255 90 35 201203 2012 3
> 60 10.58 33.25 -118.255 90 35 201203 2012 3
> 70 10.46 33.25 -118.255 90 35 201203 2012 3
> 75 10.38 33.25 -118.255 90 35 201203 2012 3
> 86 10.23 33.25 -118.255 90 35 201203 2012 3
> 100 10.06 33.25 -118.255 90 35 201203 2012 3
> 120 9.82 33.25 -118.255 90 35 201203 2012 3
> 125 9.82 33.25 -118.255 90 35 201203 2012 3
> 140 9.8 33.25 -118.255 90 35 201203 2012 3
> 150 9.64 33.25 -118.255 90 35 201203 2012 3
> 169 9.25 33.25 -118.255 90 35 201203 2012 3
> 199 8.96 33.25 -118.255 90 35 201203 2012 3
> 200 8.95 33.25 -118.255 90 35 201203 2012 3
> 231 8.6 33.25 -118.255 90 35 201203 2012 3
> 250 8.3 33.25 -118.255 90 35 201203 2012 3
> 270 8.16 33.25 -118.255 90 35 201203 2012 3
> 300 7.89 33.25 -118.255 90 35 201203 2012 3
> 320 7.79 33.25 -118.255 90 35 201203 2012 3
> 370 7.35 33.25 -118.255 90 35 201203 2012 3
> 0 13.92 33.183333 -118.391667 90 37 201203 2012 3
> 2 13.92 33.183333 -118.391667 90 37 201203 2012 3
> 10 13.93 33.183333 -118.391667 90 37 201203 2012 3
> 20 13.64 33.183333 -118.391667 90 37 201203 2012 3
> 21 13.56 33.183333 -118.391667 90 37 201203 2012 3
> 30 13.38 33.183333 -118.391667 90 37 201203 2012 3
> 41 12.89 33.183333 -118.391667 90 37 201203 2012 3
> 50 11.61 33.183333 -118.391667 90 37 201203 2012 3
> 51 11.47 33.183333 -118.391667 90 37 201203 2012 3
> 60 11.13 33.183333 -118.391667 90 37 201203 2012 3
> 71 10.71 33.183333 -118.391667 90 37 201203 2012 3
> 75 10.64 33.183333 -118.391667 90 37 201203 2012 3
> 85 10.46 33.183333 -118.391667 90 37 201203 2012 3
> 100 10.07 33.183333 -118.391667 90 37 201203 2012 3
> 122 9.76 33.183333 -118.391667 90 37 201203 2012 3
> 125 9.7 33.183333 -118.391667 90 37 201203 2012 3
> 141 9.6 33.183333 -118.391667 90 37 201203 2012 3
> 150 9.47 33.183333 -118.391667 90 37 201203 2012 3
> 170 9.12 33.183333 -118.391667 90 37 201203 2012 3
> 200 8.84 33.183333 -118.391667 90 37 201203 2012 3
> 201 8.83 33.183333 -118.391667 90 37 201203 2012 3
> 231 8.7 33.183333 -118.391667 90 37 201203 2012 3
> 250 8.5 33.183333 -118.391667 90 37 201203 2012 3
> 270 8.27 33.183333 -118.391667 90 37 201203 2012 3
> 300 7.96 33.183333 -118.391667 90 37 201203 2012 3
> 321 7.75 33.183333 -118.391667 90 37 201203 2012 3
> 381 7.19 33.183333 -118.391667 90 37 201203 2012 3
> 400 7.09 33.183333 -118.391667 90 37 201203 2012 3
> 439 6.76 33.183333 -118.391667 90 37 201203 2012 3
> 500 6.34 33.183333 -118.391667 90 37 201203 2012 3
> 515 6.28 33.183333 -118.391667 90 37 201203 2012 3
> 0 13.97 32.918333 -118.938333 90 45 201203 2012 3
> 2 13.97 32.918333 -118.938333 90 45 201203 2012 3
> 10 13.95 32.918333 -118.938333 90 45 201203 2012 3
> 10 13.95 32.918333 -118.938333 90 45 201203 2012 3
>
> I have searched the examples and the maillist, but clearly have missed
> something.
>
> Best fishes
> Sam
> --
> Sam McClatchie (fisheries oceanographer)
> & Elena Turin (accounting & auditing)
> FishOcean Enterprises
> 38 Upland Rd, Huia, Auckland 0604, New Zealand
> cell: 027 752 8495
> Internet <http://www.fishocean.info>
>
>
> "The time has come", the tui said,
> "to talk of many things:
> Of songs - and ferns - and flowering flax,
> of Pukekos and dreams ..."
>
> (not Lewis Carroll)
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180918/dd7aff61/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SamMcClatchie2_small.jpg
Type: image/jpeg
Size: 45362 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180918/dd7aff61/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SamMcClatchie2_small.jpg
Type: image/jpeg
Size: 45362 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180918/dd7aff61/attachment-0001.jpg>
-------------- next part --------------
-9999
0 13.95 33.483333 -117.77 90 28 201203 2012 3
2 13.95 33.483333 -117.77 90 28 201203 2012 3
5 13.94 33.483333 -117.77 90 28 201203 2012 3
10 13.68 33.483333 -117.77 90 28 201203 2012 3
11 13.39 33.483333 -117.77 90 28 201203 2012 3
20 11.89 33.483333 -117.77 90 28 201203 2012 3
30 11.34 33.483333 -117.77 90 28 201203 2012 3
41 10.91 33.483333 -117.77 90 28 201203 2012 3
50 10.6 33.483333 -117.77 90 28 201203 2012 3
51 10.55 33.483333 -117.77 90 28 201203 2012 3
60 10.45 33.483333 -117.77 90 28 201203 2012 3
0 13.99 33.418333 -117.898333 90 30 201203 2012 3
2 13.99 33.418333 -117.898333 90 30 201203 2012 3
10 13.93 33.418333 -117.898333 90 30 201203 2012 3
11 13.89 33.418333 -117.898333 90 30 201203 2012 3
11 13.89 33.418333 -117.898333 90 30 201203 2012 3
20 13.74 33.418333 -117.898333 90 30 201203 2012 3
30 13.22 33.418333 -117.898333 90 30 201203 2012 3
31 12.79 33.418333 -117.898333 90 30 201203 2012 3
40 12.17 33.418333 -117.898333 90 30 201203 2012 3
50 11.25 33.418333 -117.898333 90 30 201203 2012 3
60 10.75 33.418333 -117.898333 90 30 201203 2012 3
70 10.59 33.418333 -117.898333 90 30 201203 2012 3
75 10.4 33.418333 -117.898333 90 30 201203 2012 3
85 10.26 33.418333 -117.898333 90 30 201203 2012 3
100 10.1 33.418333 -117.898333 90 30 201203 2012 3
119 9.93 33.418333 -117.898333 90 30 201203 2012 3
125 9.76 33.418333 -117.898333 90 30 201203 2012 3
141 9.56 33.418333 -117.898333 90 30 201203 2012 3
150 9.48 33.418333 -117.898333 90 30 201203 2012 3
170 9.32 33.418333 -117.898333 90 30 201203 2012 3
200 9.26 33.418333 -117.898333 90 30 201203 2012 3
201 9.22 33.418333 -117.898333 90 30 201203 2012 3
231 8.84 33.418333 -117.898333 90 30 201203 2012 3
250 8.72 33.418333 -117.898333 90 30 201203 2012 3
270 8.61 33.418333 -117.898333 90 30 201203 2012 3
300 8.57 33.418333 -117.898333 90 30 201203 2012 3
320 8.21 33.418333 -117.898333 90 30 201203 2012 3
381 7.74 33.418333 -117.898333 90 30 201203 2012 3
400 7.54 33.418333 -117.898333 90 30 201203 2012 3
441 6.98 33.418333 -117.898333 90 30 201203 2012 3
500 6.57 33.418333 -117.898333 90 30 201203 2012 3
516 6.46 33.418333 -117.898333 90 30 201203 2012 3
0 13.9 33.25 -118.255 90 35 201203 2012 3
2 13.9 33.25 -118.255 90 35 201203 2012 3
10 13.88 33.25 -118.255 90 35 201203 2012 3
10 13.88 33.25 -118.255 90 35 201203 2012 3
20 13.01 33.25 -118.255 90 35 201203 2012 3
30 11.66 33.25 -118.255 90 35 201203 2012 3
40 11.2 33.25 -118.255 90 35 201203 2012 3
50 10.79 33.25 -118.255 90 35 201203 2012 3
51 10.73 33.25 -118.255 90 35 201203 2012 3
60 10.58 33.25 -118.255 90 35 201203 2012 3
70 10.46 33.25 -118.255 90 35 201203 2012 3
75 10.38 33.25 -118.255 90 35 201203 2012 3
86 10.23 33.25 -118.255 90 35 201203 2012 3
100 10.06 33.25 -118.255 90 35 201203 2012 3
120 9.82 33.25 -118.255 90 35 201203 2012 3
125 9.82 33.25 -118.255 90 35 201203 2012 3
140 9.8 33.25 -118.255 90 35 201203 2012 3
150 9.64 33.25 -118.255 90 35 201203 2012 3
169 9.25 33.25 -118.255 90 35 201203 2012 3
199 8.96 33.25 -118.255 90 35 201203 2012 3
200 8.95 33.25 -118.255 90 35 201203 2012 3
231 8.6 33.25 -118.255 90 35 201203 2012 3
250 8.3 33.25 -118.255 90 35 201203 2012 3
270 8.16 33.25 -118.255 90 35 201203 2012 3
300 7.89 33.25 -118.255 90 35 201203 2012 3
320 7.79 33.25 -118.255 90 35 201203 2012 3
370 7.35 33.25 -118.255 90 35 201203 2012 3
0 13.92 33.183333 -118.391667 90 37 201203 2012 3
2 13.92 33.183333 -118.391667 90 37 201203 2012 3
10 13.93 33.183333 -118.391667 90 37 201203 2012 3
20 13.64 33.183333 -118.391667 90 37 201203 2012 3
21 13.56 33.183333 -118.391667 90 37 201203 2012 3
30 13.38 33.183333 -118.391667 90 37 201203 2012 3
41 12.89 33.183333 -118.391667 90 37 201203 2012 3
50 11.61 33.183333 -118.391667 90 37 201203 2012 3
51 11.47 33.183333 -118.391667 90 37 201203 2012 3
60 11.13 33.183333 -118.391667 90 37 201203 2012 3
71 10.71 33.183333 -118.391667 90 37 201203 2012 3
75 10.64 33.183333 -118.391667 90 37 201203 2012 3
85 10.46 33.183333 -118.391667 90 37 201203 2012 3
100 10.07 33.183333 -118.391667 90 37 201203 2012 3
122 9.76 33.183333 -118.391667 90 37 201203 2012 3
125 9.7 33.183333 -118.391667 90 37 201203 2012 3
141 9.6 33.183333 -118.391667 90 37 201203 2012 3
150 9.47 33.183333 -118.391667 90 37 201203 2012 3
170 9.12 33.183333 -118.391667 90 37 201203 2012 3
200 8.84 33.183333 -118.391667 90 37 201203 2012 3
201 8.83 33.183333 -118.391667 90 37 201203 2012 3
231 8.7 33.183333 -118.391667 90 37 201203 2012 3
250 8.5 33.183333 -118.391667 90 37 201203 2012 3
270 8.27 33.183333 -118.391667 90 37 201203 2012 3
300 7.96 33.183333 -118.391667 90 37 201203 2012 3
321 7.75 33.183333 -118.391667 90 37 201203 2012 3
381 7.19 33.183333 -118.391667 90 37 201203 2012 3
400 7.09 33.183333 -118.391667 90 37 201203 2012 3
439 6.76 33.183333 -118.391667 90 37 201203 2012 3
500 6.34 33.183333 -118.391667 90 37 201203 2012 3
515 6.28 33.183333 -118.391667 90 37 201203 2012 3
0 13.97 32.918333 -118.938333 90 45 201203 2012 3
2 13.97 32.918333 -118.938333 90 45 201203 2012 3
10 13.95 32.918333 -118.938333 90 45 201203 2012 3
10 13.95 32.918333 -118.938333 90 45 201203 2012 3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sam.png
Type: image/png
Size: 43248 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180918/dd7aff61/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sam.ncl
Type: text/x-ncl
Size: 1663 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180918/dd7aff61/attachment.bin>


More information about the ncl-talk mailing list