<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi all,</p>
<p><br>
</p>
<p>Thanks to Rick Brownrigg for his help. That was really helpful!</p>
<p><br>
</p>
<p>Using the 2 following methods seem to work well:</p>
<p>- either both "delete(res)" and "delete(wks)" before each plot</p>
<p>- or a new "res" (like "res3" for a 3rd plot) and a new "wks" (like "wks3" for a 3rd plot) for each plot</p>
<p>I do get a figure with the things I want in it.</p>
<p><br>
</p>
<p>The only things remaining are the colours (to match with the legend of course)! I get 3 lines in "cyan", and 3 legend items in "cyan", while I do ask for several colours: e.g. res3@xyLineColor = (/"cyan","blue","green"/). Do you have an idea on how to sort
that out?</p>
<p><br>
</p>
<p>I attach a figure of what I get, so that you can visualise the small issue left.</p>
<p><br>
</p>
<p>Thank you,</p>
<p><br>
</p>
<p>Maxime<br>
</p>
<p><br>
</p>
<p><br>
</p>
<div style="color: rgb(26, 26, 26);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Rick Brownrigg <brownrig@ucar.edu><br>
<b>Sent:</b> Friday, 1 April 2016 4:33 AM<br>
<b>To:</b> Maxime Colin<br>
<b>Subject:</b> Re: [ncl-talk] I can't manage to create a plot with multiple lines on it, each line having different x and y values. Attribute assignment type issue.</font>
<div> </div>
</div>
<div>
<div dir="ltr">Just to follow up, I had meant to attach an example of what I was talking about in point i):<br>
<br>
<br>
<br>
ncl 0> opt = True<br>
ncl 1> res = opt<br>
ncl 2> res@foo = 1<br>
ncl 3> res@bar = 2<br>
ncl 4> print(res)<br>
<br>
<br>
Variable: res<br>
Type: logical<br>
Total Size: 4 bytes<br>
1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [1]<br>
Coordinates: <br>
Number Of Attributes: 2<br>
bar : 2<br>
foo : 1<br>
(0) True<br>
ncl 5> res = opt<br>
ncl 6> print(res)<br>
<br>
<br>
Variable: res<br>
Type: logical<br>
Total Size: 4 bytes<br>
1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [1]<br>
Coordinates: <br>
Number Of Attributes: 2<br>
bar : 2 <<<<< NOTE these values are retained from previous settings<br>
foo : 1<br>
(0) True<br>
<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Mar 31, 2016 at 11:27 AM, Rick Brownrigg <span dir="ltr">
<<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>Hi Maxine,<br>
<br>
</div>
A couple of comments:<br>
<br>
</div>
i) for each plot, you first set "opt = True", then either "res = opt" or "res2 = opt", and then assign a bunch of resources for the plot. But after the first plot., performing "res = opt" doesn't affect the values or presence of resources associated with "res"
from the previous plots. So for example, in one plot, you've set "res@xyLineThickness = 8", a scalar integer value. In a subsequent plot, where the error message arises, you set "res@xyLineThickness = (/ ..... /), an array of floats, and as you likely know
NCL won't allow reassignment of incompatible types.<br>
<br>
</div>
The solution would be to "delete(res)" for each plot.<br>
<br>
</div>
ii) In a similar vein, you are re-opening the workstation for each plot and assigning it to "wks". I'm not totally certain what the behavior is there, and whether the previous plots get written and closed out properly. As odd as it seems, performing "delete(wks)"
will close the plot/workstation. Alternatively, if the workstation is the same for each plot, its not necessary to reopen a new instance for each plot -- just open once at the top, and it will get closed properly when the script terminates.<br>
<br>
</div>
Hope that helps...<br>
</div>
Rick<br>
<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">
<div>
<div class="h5">On Thu, Mar 31, 2016 at 10:57 AM, Maxime Colin <span dir="ltr"><<a href="mailto:m.colin@unsw.edu.au" target="_blank">m.colin@unsw.edu.au</a>></span> wrote:<br>
</div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div class="h5">
<div dir="ltr">
<div style="font-size:12pt; color:#000000; background-color:#ffffff; font-family:Calibri,Arial,Helvetica,sans-serif">
<p><br>
</p>
<br>
<div style="color:rgb(26,26,26)">
<div dir="ltr"></div>
<div>
<div style="font-size:12pt; color:#000000; background-color:#ffffff; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Dear NCL gurus,</p>
<p><br>
</p>
<p>I've used NCL for more than a year, but this problem seems to be particularly tough to solve, so I think I need to refer to you.<br>
</p>
<p><br>
</p>
<p>I've been working on a script for days, I've turned it in different ways (array of data, overlay, using a single y-axis, etc...), but I can't seem to find the solution. I had a script to plot several lines on the same graph, but these lines had exactly the
same x-axis. That was working fine. Now I'm trying to plot several profiles, that all have different x and y values, but I always receive the following error (after a bunch of warnings due to the fact that I'm plotting several types of plots with the same
script):</p>
<p><br>
</p>
<p>warning:MainTitle is not a valid resource in plot_theta_hor_ave_fct_time_and_z_0130_3D_No_strong_nudg_CONTROL_ALL90d_v1_contour at this time<br>
warning:MainTitle is not a valid resource in plot_temp_hor_ave_fct_time_and_z_0130_3D_No_strong_nudg_CONTROL_ALL90d_v1_contour at this time<br>
warning:MainTitle is not a valid resource in plot_eth_hor_ave_fct_time_and_z_0130_3D_No_strong_nudg_CONTROL_ALL90d_v1_contour at this time<br>
warning:cnFillOn is not a valid resource in plot_T500_hor_ave_0130_3D_No_strong_nudg_CONTROL_ALL90d_v1_xy at this time<br>
warning:gsnSpreadColors is not a valid resource in plot_T500_hor_ave_0130_3D_No_strong_nudg_CONTROL_ALL90d_v1_xy at this time<br>
warning:cnLineLabelsOn is not a valid resource in plot_T500_hor_ave_0130_3D_No_strong_nudg_CONTROL_ALL90d_v1_xy at this time<br>
warning:cnLevelSelectionMode is not a valid resource in plot_T500_hor_ave_0130_3D_No_strong_nudg_CONTROL_ALL90d_v1_xy at this time<br>
warning:MainTitle is not a valid resource in plot_T500_hor_ave_0130_3D_No_strong_nudg_CONTROL_ALL90d_v1_xy at this time</p>
<p><br>
fatal:["NclAtt.c":262]:Attribute assignment type mismatch.<br>
<br>
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 589 in file plot_temperature.ncl</p>
<p><br>
</p>
<p><br>
</p>
<p>I attach the whole script if needed (plot_temperature.ncl), but here is the relevant part (the error I receive refering to line res@xyLineThicknesses = (/8.0,8.0,8.0/) ):</p>
<p><br>
</p>
<p>"</p>
<p>; PLOT NUMBER 11<br>
; type@wkPaperSize = "A4"<br>
wks = gsn_open_wks(type,"plot_prof_theta_ALL_0130_3D_No_strong_nudg_CONTROL_ALL90d_v1") ; Create a plot workstation + TITLE OF THE FILE TO SAVE<br>
opts = True<br>
res = opts<br>
res@lbOrientation = "Vertical"<br>
res@gsnMaximize = True<br>
res@tmXTOn = False<br>
<br>
res@pmLegendDisplayMode = "Always"<br>
res@pmLegendSide = "Top"<br>
res@pmLegendOrthogonalPosF = -0.58 ;-0.02 (too high), 0.15 the same, -0.15 half box is too high<br>
res@pmLegendParallelPosF = .67 ; 0.2 is very good<br>
res@pmLegendWidthF = 0.0375<br>
res@pmLegendHeightF = 0.28<br>
res@lgLabelFontHeightF = 0.02<br>
res@xyExplicitLegendLabels = (/legend_theta(0), legend_theta(1), legend_theta(2)/)<br>
<br>
res@xyLineThicknesses = (/8.0,8.0,8.0/)<br>
res@xyLineColor = (/"cyan","blue","green"/)<br>
res@xyDashPatterns = (/0,0,0/)<br>
res@trXMinF = 200.<br>
res@trXMaxF = 800.<br>
res@trYMinF = 0.<br>
res@trYMaxF = 30. ;30000<br>
res@tiXAxisString = "Pot. temp (K)"<br>
res@tiYAxisString = "z (km)"<br>
res@tiMainString = "Pot. Temp. profiles"<br>
<br>
plot = gsn_csm_xy(wks,array_of_theta_prof,array_of_heights,res)<br>
<br>
</p>
<p>"<br>
</p>
<p><br>
</p>
<p>The netcdf files I'm using are just standard WRF output from an idealized quarter_ss type simulation. They are big files (~30GB) so I'd rather not add them now. If necessary, I'll put a few of them online.</p>
<p><br>
NOTE: If you wish to try the script on a smaller number of wrfout files, just change the num_day_max variable to a small number (I receive the same error in any case). If you don't use 90 files (as the target is), then some of the profiles in array_of_heights
and array_of_theta_prof may be undefined. But I have checked that this is not the reason for my issue, as I get the same errors when running on the full 90 files. To avoid this slight issue, you may run the cleaned version: plot_temperature_cleaned.ncl<br>
</p>
<p><br>
</p>
<p>For information, I'm using NCL v6.3.0.</p>
<p>And "uname -a" returns: Linux <a href="http://monsoon.ccrc.unsw.edu.au" target="_blank">
monsoon.ccrc.unsw.edu.au</a> 2.6.32-573.8.1.el6.x86_64 #1 SMP Tue Nov 10 18:01:38 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux<br>
</p>
<p><br>
</p>
<p>Thank you very much for your assistance.</p>
<span><font color="#888888">
<p><br>
</p>
<p>Maxime.<br>
</p>
</font></span></div>
</div>
</div>
</div>
</div>
<br>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>