<div dir="ltr">Hi David,<div>I would explicitly set the the X-axis labels, as opposed to altering the time coordinate variable. The error messages are likely because your new time coordinate variable values are very irregular and each set of 4 is close together, and NCL is having trouble plotting it. Instead of this:</div><div>temp&tim = cd_calendar(tim,-3)<br></div><div>do this:</div><div>time_labels = cd_calendar(tim,-3)<br></div><div><br></div><div>then add this to your resource list:</div><div> res@tmXBMode = "Explicit"<br> res@tmXBValues = tim(0::4) ; alter these settings<br> res@tmXBLabels = time_labels(0::4) ; as you wish<br></div><div><br></div><div>I've attached a modified script and the resulting plot.</div><div>If you have any further questions let ncl-talk know.</div><div>Adam</div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 5, 2019 at 6:03 AM David Warner via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><font size="4">Dear NCL users,</font><div class="gmail_quote"><div dir="ltr"><div><font size="4"><br></font></div><div><font size="4">I am using gsn_csm_pres_hgt to draw pressure vs. height plot. My time axis values are ranging from [1024536..1024638], however I would like to replace them in the following date format 2017120100 (YMDH). I tried using "cd_calendar (tim,-3)" to make the date conversion. But I encounter the following error when I tried to plot:</font><br></div><div><p>warning:IrTransInitialize: trXCoordPoints contains invalid coordinate array: defaulting trXAxisType to LinearAxis<br>warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation for X axis failed: consider adjusting trXTensionF value<br>warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation for X axis failed: consider adjusting trXTensionF value<br>warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation for X axis failed: consider adjusting trXTensionF value<br>fatal:IrTransInitialize: spline coordinate approximation not possible:<br>fatal:Unable to initialize layer-Can't Create<br>fatal:ContourPlotInitialize: Error creating transformation object<br>fatal:ContourPlotInitialize: error setting up transformation<br>fatal:Unable to initialize layer-Can't Create<br>fatal:Unable to access object with id:-4<br>fatal:PID #-4 can't be found in NhlSetValues<br>fatal:NhlGetValues:PID #-4 is invalid<br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 2212 in file /usr/local/ncl-6.6.2/lib/ncarg/nclscripts/csm/gsn_code.ncl<br><br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 10216 in file /usr/local/ncl-6.6.2/lib/ncarg/nclscripts/csm/gsn_code.ncl<br><br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 13414 in file /usr/local/ncl-6.6.2/lib/ncarg/nclscripts/csm/gsn_csm.ncl<br><br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 13553 in file /usr/local/ncl-6.6.2/lib/ncarg/nclscripts/csm/gsn_csm.ncl<br><br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 13832 in file /usr/local/ncl-6.6.2/lib/ncarg/nclscripts/csm/gsn_csm.ncl<br><br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 39 in file warm_core.ncl<br></p><br></div><div><font size="4">I am attaching my script and the test figure(without making the date conversion). How to rectify this error to assign the desired time axis along x-axis?</font></div><div><font size="4"><br></font></div><div><b><font size="4">; print output:</font></b></div><div><b><font size="4"><br></font></b></div><div><font size="2">Variable: f<br>Type: file<br>filename: tanom<br>path: <a href="http://tanom.nc" target="_blank">tanom.nc</a><br> file global attributes:<br> history : PyFERRET V7 (opt) 5-Aug-19<br> Conventions : CF-1.6<br> dimensions:<br> LV_ISBL0 = 46<br> bnds = 2<br> TAX = 18 // unlimited<br> variables:<br> float LV_ISBL0 ( LV_ISBL0 )<br> units : pa<br> long_name : Isobaric surface<br> point_spacing : uneven<br> axis : Z<br> bounds : LV_ISBL0_bnds<br> standard_name : altitude<br><br> float LV_ISBL0_bnds ( LV_ISBL0, bnds )<br><br> double TAX ( TAX )<br> units : hours since 1901-01-15 00:00:00<br> axis : T<br> calendar : GREGORIAN<br> time_origin : 15-JAN-1901<br> standard_name : time<br><br> double ANM ( TAX, LV_ISBL0 )<br> missing_value : -9.999999999999999e+33<br> _FillValue : -9.999999999999999e+33<br> long_name : TEMP[D=1,X=74.2,Y=8.7]-T_REF<br> long_name_mod : X=61.5E:86.5E, Y=3.9S:21.1N<br><br><br><br>Variable: tim<br>Type: double<br>Total Size: 144 bytes<br> 18 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [TAX | 18]<br>Coordinates: <br> TAX: [1024536..1024638]<br>Number Of Attributes: 5<br> units : hours since 1901-01-15 00:00:00<br> axis : T<br> calendar : GREGORIAN<br> time_origin : 15-JAN-1901<br> standard_name : time<br>(0) 1024536<br>(1) 1024542<br>(2) 1024548<br>(3) 1024554<br>(4) 1024560<br>(5) 1024566<br>(6) 1024572<br>(7) 1024578<br>(8) 1024584<br>(9) 1024590<br>(10) 1024596<br>(11) 1024602<br>(12) 1024608<br>(13) 1024614<br>(14) 1024620<br>(15) 1024626<br>(16) 1024632<br>(17) 1024638<br><br>Variable: temp<br>Type: double<br>Total Size: 5760 bytes<br> 720 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [tim | 18] x [lev | 40]<br>Coordinates: <br> tim: [2017120100..2017120506]<br> lev: [100000..5000]<br>Number Of Attributes: 5<br> units : K<br> missing_value : -9.999999999999999e+33<br> _FillValue : -9.999999999999999e+33<br> long_name : Temperature Perturbation<br> long_name_mod : X=61.5E:86.5E, Y=3.9S:21.1N<br><br><br>Variable: tim (coordinate)<br>Type: double<br>Total Size: 144 bytes<br> 18 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [tim | 18]<br>Coordinates: <br>Number Of Attributes: 5<br> calendar : GREGORIAN<br> units : hours since 1901-01-15 00:00:00<br> axis : T<br> time_origin : 15-JAN-1901<br> standard_name : time<br>(0) 2017120100<br>(1) 2017120106<br>(2) 2017120112<br>(3) 2017120118<br>(4) 2017120200<br>(5) 2017120206<br>(6) 2017120212<br>(7) 2017120218<br>(8) 2017120300<br>(9) 2017120306<br>(10) 2017120312<br>(11) 2017120318<br>(12) 2017120400<br>(13) 2017120406<br>(14) 2017120412<br>(15) 2017120418<br>(16) 2017120500<br>(17) 2017120506<br></font></div><div><font size="2"><br></font></div><div><font size="2"><br></font></div><div><font size="4">Thanks and regards.</font><br></div></div>
</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></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="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">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>