Re: Beginning Longitude

From: Dennis Shea (shea AT cgd.ucar.edu)
Date: Mon Nov 07 2005 - 10:28:24 MST

  • Next message: Dennis Shea: "Re: regrid PCM displaced pole grid to regular grid"

     This is a permutation ...

     If you are plotting a time series where the
     temporal values correspond to Jan1982, Feb1982, ...
     then what you really want are x-axis [ie, time-axis]
     values 1982.0, 1982.0833, 1982.1667, ...,1982.9167, 1983.0, ..

     There is an undocumented function "yyyymm2yyyyFrac"
     that will convert yyyymm to year + fractional part
     of the year:

         yyyyFrac = yyyymm2yyyyFrac( yyyymm ) ; undocumented contributed.ncl

     Then, you could do as Mary suggests:

         x!0 = "time"
         x&time = yyyyFrac

     This could be used directly for the x-axis

         plot = gsn_csm_xy (wks, yyyyFrac, time_series, res)

     You could use the following to get labels of the form "Jan1982"
     
         | | | | .....
       Jan1982 Apr1982
         

      res@tmXBMode = "Explicit"
      res@tmXBValues = yyyyFrac
      res@tmXBLabels = (/ "Jan1982, "", "" , "Apr1982", ...../)
      
    To put the labels at an angle: res@tmXBLabelAngleF

    Some Examples:
    http://www.ncl.ucar.edu/Applications/histo.shtml : Ex 4 and 5
    http://www.ncl.ucar.edu/Applications/tickmarks.shtml : Ex 5

    ----
    

    Please note in the next release "a033" [hopefully, very soon], the above function will continue to be available. In addition, there will be a documentated function named "yyyymm_to_yyyyfrac" which is a slight generalization of this function.

    http://www.ncl.ucar.edu/Document/Functions/Contributed/yyyymm_to_yyyyfrac.shtml

    ----

    > > > > >> >>> Another question: >>> >>> Can I assign time coordinates to a variable as calendar dates? For example, >>> can I have a time axis as jan1982, feb1982, mar1982....? >> >> Yes, you can do this. Please see the documention for the "ut_calendar" >> function: >> >> http://www.ncl.ucar.edu/Document/Functions/Built-in/ut_calendar.shtml >> >> and look at example 1. I'm not sure if you already have time values >> and you need to convert them to "MonXXXX", but this should help: >> >> Once you have your time variable (call it "time"), you can assign it >> as a coordinate array of your variable (call it "x") in the usual way: >> >> time@units = "MMYYYY" >> ... >> x!0 = "time" >> x&time = time >> >> For an application example on assigning a new time coordinate >> variable, go to: >> >> http://www.ncl.ucar.edu/Applications/cru.shtml >> >> and see example 4 or 5. >> >> We have a "time" applications page: >> >> http://www.ncl.ucar.edu/Applications/time.shtml >> >> but I see that it badly needs some more examples. I will put this on >> our "to do" list for enhancing the application pages. > >

    ------------- End Forwarded Message -------------

    _______________________________________________ ncl-talk mailing list ncl-talk@ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Mon Nov 07 2005 - 11:26:07 MST