<div dir="ltr">Dilip,<div><br></div><div>The problem is that time coordinates as YYYYMMDD are too finely spaced for the built-in plot generator.  A quick fix is to insert this line just before the call to gsn_csm_contour:</div><div><br></div><div>      oxn&time = oxn&time - 20130000</div><div><br></div><div>There is more than one way to fix this.  For one proper solution, please see example 4 on the Time Axis Labels example page.  This example discusses the same problem you are having with the X coordinate.  To use this solution, keep the original time coordinates, and do not convert them to YYYYMMDD numbers.</div><div><br></div><div><div>     <a href="http://www.ncl.ucar.edu/Applications/time_labels.shtml">http://www.ncl.ucar.edu/Applications/time_labels.shtml</a><br></div><div><br></div><div>--Dave</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 16, 2018 at 3:22 AM, Dilip V <span dir="ltr"><<a href="mailto:dilip.v@students.iiserpune.ac.in" target="_blank">dilip.v@students.iiserpune.ac.in</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello!<div><br></div><div>I wanted to plot a contour map of lat v/s time for Precipitation anomaly over certain longitude. The time coordinates were given in "Hours since 1900-01-01 00:00:00". I converted them to YYYYMMDD using 'cd_calendar' and saved it as a new time coordinates. When i tried plotting, i got the following error message</div><div>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------</div><div>warning:IrTransInitialize: trXCoordPoints contains invalid coordinate array: defaulting trXAxisType to LinearAxis</div><div>warning:_<wbr>NhlCreateSplineCoordApprox: Attempt to create spline approximation for X axis failed: consider adjusting trXTensionF value</div><div>warning:_<wbr>NhlCreateSplineCoordApprox: Attempt to create spline approximation for X axis failed: consider adjusting trXTensionF value</div><div>warning:_<wbr>NhlCreateSplineCoordApprox: Attempt to create spline approximation for X axis failed: consider adjusting trXTensionF value</div><div>fatal:IrTransInitialize: spline coordinate approximation not possible:</div><div>fatal:Unable to initialize layer-Can't Create</div><div>fatal:ContourPlotInitialize: Error creating transformation object</div><div>fatal:ContourPlotInitialize: error setting up transformation</div><div>fatal:Unable to initialize layer-Can't Create</div><div>fatal:Unable to access object with id:-4</div><div>fatal:PID #-4 can't be found in NhlSetValues</div><div>fatal:NhlGetValues:PID #-4 is invalid</div><div>fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 2222 in file /apps/codes/gnu/ncl_stable/<wbr>lib/ncarg/nclscripts/csm/gsn_<wbr>code.ncl</div><div><br></div><div>fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 9571 in file /apps/codes/gnu/ncl_stable/<wbr>lib/ncarg/nclscripts/csm/gsn_<wbr>code.ncl</div><div><br></div><div>fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 13393 in file /apps/codes/gnu/ncl_stable/<wbr>lib/ncarg/nclscripts/csm/gsn_<wbr>csm.ncl</div><div><br></div><div>fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 224 in file pract8.ncl </div><div>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>-----------</div><div><br></div><div>My data includes only one year of daily precipitation data with specifications as below.</div><div><br></div><div>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>----</div><div><div>Variable: p</div><div>Type: float</div><div>Total Size: 52560 bytes</div><div>            13140 values</div><div>Number of Dimensions: 3</div><div>Dimensions and sizes:<span style="white-space:pre-wrap">       </span>[time | 365] x [lat | 6] x [lon | 6]</div><div>Coordinates: </div><div>            time: [990552..999288]</div><div>            lat: [28.75..31.25]</div><div>            lon: [78.25..80.75]</div><div>Number Of Attributes: 14</div><div>  _FillValue :<span style="white-space:pre-wrap">   </span>-9.96921e+36</div><div>  var_desc :<span style="white-space:pre-wrap">        </span>Precipitation</div><div>  valid_range :<span style="white-space:pre-wrap">    </span>(  0, 1000 )</div><div>  units :<span style="white-space:pre-wrap">  </span>mm</div><div>  statistic :<span style="white-space:pre-wrap"> </span>Total</div><div>  parent_stat :<span style="white-space:pre-wrap">    </span>Other</div><div>  missing_value :<span style="white-space:pre-wrap">  </span>-9.96921e+36</div><div>  long_name :<span style="white-space:pre-wrap">       </span>Daily total of precipitation</div><div>  level_desc :<span style="white-space:pre-wrap">      </span>Surface</div><div>  dataset :<span style="white-space:pre-wrap">      </span>CPC Global Precipitation</div><div>  cell_methods :<span style="white-space:pre-wrap">        </span>time: sum</div><div>  avg_period :<span style="white-space:pre-wrap"> </span>0000-00-01 00:00:00</div><div>  actual_range :<span style="white-space:pre-wrap">     </span>(  0, 473.6278 )</div><div>  DIMENSION_LIST :<span style="white-space:pre-wrap">     </span>-2147483647</div></div><div>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>----------</div><div><br></div><div><b>How do i plot contour map of lat v/s time with time coordinates in YYYYMMDD format for a certain time period? </b></div><div><br></div><div>My code for the above is as follows:</div><div><br></div><div>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>---------</div><div><div>read = 1</div><div>if (read.ne.0) then</div><div>f = addfile("<a href="http://precip_2013.nc" target="_blank">precip_2013.nc</a>","r")</div><div>p = f->precip(:,{28.75:31.25},{78.<wbr>25:80.75})</div><div>pr = p(lat|:,lon|:,time|:)  </div><div>prm = dim_avg_Wrap(pr)</div><div>prnew = new((/6,6,365/),float)</div><div>t = f->time</div><div>tim = cd_calendar(t,2)</div><div><br></div><div>;computing anomoly at all points</div><div>do i = 0,5</div><div>    do j = 0,5</div><div>        do k = 0,364</div><div>            prnew(i,j,k) = (pr(i,j,k)-prm(i,j))</div><div>        end do </div><div>    end do</div><div>end do</div><div>prnew!0 = "lat"</div><div>prnew!1 = "lon"</div><div>prnew!2 = "time"</div><div>prn = prnew(time|:,lat|:,lon|:)</div><div><br></div><div>;applying fft over anomoly at all points</div><div>ft = new((/2,365,6,6/),float)</div><div>do h = 0,5</div><div>    do k = 0,5</div><div>        gt = cfftf(prn(:,h,k),0.0,0)</div><div>        ft(0,:,h,k) = gt(0,:)</div><div>        ft(1,:,h,k) = gt(1,:)</div><div>    end do</div><div>end do</div><div><br></div><div>;filtering out unwanted frequencies</div><div>do h = 0,5</div><div>    do k = 0,5</div><div>        ft(0,13:352,h,k) = 0.0</div><div>        ft(1,13:352,h,k) = 0.0</div><div>        ft(0,360:,h,k)   = 0.0</div><div>        ft(1,360:,h,k)   = 0.0</div><div>        ft(0,0:5,h,k)    = 0.0</div><div>        ft(1,0:5,h,k)    = 0.0</div><div>    end do</div><div>end do</div><div><br></div><div>;ifft of required frequencies</div><div>ift = new((/365,6,6/),float)</div><div>do h = 0,5</div><div>    do k = 0,5</div><div>        kt = cfftb(ft(:,:,h,k),1)</div><div>        ift(:,h,k) = kt(:)</div><div>    end do</div><div>end do</div><div>ift!0 = "time"</div><div>ift!1 = "lat"</div><div>ift!2 = "lon"</div><div>iftnew = ift(lat|:,lon|:,time|:)</div><div><br></div><div><br></div><div>copy_VarAtts(pr,iftnew)</div><div>copy_VarCoords(pr,iftnew)</div><div>oxn = iftnew(lon|:,lat|:,time|:)</div><div>oxn@long_name = "30-60 day anomoly of precipitation"</div><div>oxn&time = tim</div><div>wks  = gsn_open_wks ("png", "lat_time" )           ; send graphics to PNG file</div><div><br></div><div>  res                      = True               ; plot mods desired</div><div>  res@cnFillOn             = True  ; turn on color fill</div><div>  res@cnFillPalette        = "BlWhRe"           ; set color map</div><div>  res@cnLinesOn            = False</div><div>  res@tiMainString         = "Uttarkhand at 79.25E"   ; title</div><div>  res@tiYAxisString        = "Latitude"</div><div>  res@cnLevelSelectionMode = "AutomaticLevels"     ; manual contour levels</div><div>  res@lbOrientation        = "Vertical"</div><div>  </div><div>  plot = gsn_csm_contour(wks, oxn({79.25},:,160:170), res) </div><div>  </div><div>end if</div></div><div>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>----------------------</div><div><div><div class="gmail-m_3548894359573498437gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><b>By,</b></div><div><b>Dilip.V</b></div><div><b>Master's Student,</b></div><div><b>Indian Institute of Science Education and Research,</b></div><div><b>Pune, India</b></div></div></div></div></div></div></div></div></blockquote></div></div></div></div>