[ncl-talk] convert the time "since seconds" to month-year
Mary Haley
haley at ucar.edu
Tue Dec 11 12:53:52 MST 2018
To help with coding NCL and correctly spelling resources, I highly
recommend using an editor enhancement that will highlight correctly spelled
NCL functions and resources for you. You can see some samples and
documentation at:
http://www.ncl.ucar.edu/Applications/editor.shtml
I've attached a PNG image that shows what part of your original "xy.ncl"
script looks like with the emacs editor enhancements. Note that the
correctly spelled resources are green, while the ones that are not
(tmXValues and tmXLabels) are black.
Also, if you run across an error or warning message you don't understand,
visit the "common NCL error messages" page:
http://www.ncl.ucar.edu/Document/Language/error_messages.shtml
Regards,
--Mary
On Tue, Dec 11, 2018 at 12:02 PM Dennis Shea <shea at ucar.edu> wrote:
> When you encounter an error like this, I *s*uggest that you examine the
> 'tm' resources.
>
> At the top of the NCL home page: (a) click 'Resources'; (b) click 'tm'
> [Tickmark].
>
>
> *http://www.ncl.ucar.edu/Document/Graphics/Resources/tm.shtml*
> <http://www.ncl.ucar.edu/Document/Graphics/Resources/tm.shtml>
>
> tmXLabels <--- No such label. Misspelled!
>
> There is a
>
> tmXBLabels<--- ?what you want?
>
> =======
> A less sophisticated method:
>
>
> *http://www.ncl.ucar.edu/Document/Functions/Contributed/yyyymm_to_yyyyfrac.shtml*
> <http://www.ncl.ucar.edu/Document/Functions/Contributed/yyyymm_to_yyyyfrac.shtml>
>
> *http://www.ncl.ucar.edu/Applications/time.shtml*
> <http://www.ncl.ucar.edu/Applications/time.shtml>
>
> tstart = 2000
> tend = 2006
> yyyymm = *yyyymm_time* <http://www.ncl.ucar.edu/Document/Functions/Contributed/yyyymm_time.shtml>(tstart, tend, "integer")
>
> or
> yyyymm = *cd_calendar* <http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_calendar.shtml>(time, *-1*)
>
> then
>
> yyyyfrac = yyyymm_to_yyyyfrac(yyyymm,0) ; create fractional years for plotting purposes
> ; XB axis
> plot = gsn_csm_xy(wks,yyyyfrac, y,res)
>
>
> On Tue, Dec 11, 2018 at 11:34 AM Amal Inge <amalingenieur89 at gmail.com>
> wrote:
>
>> Thanks Rick, it works now but it's not reading the tickmarks it gives me
>> this warning:
>> warning:tmXValues is not a valid resource in xy_xy at this time
>> warning:tmXLabels is not a valid resource in xy_xy at this time
>> warning:tmXValues is not a valid resource in xy_xy at this time
>> warning:tmXLabels is not a valid resource in xy_xy at this time
>>
>> the plot attached
>>
>> Le mar. 11 déc. 2018 à 18:53, Rick Brownrigg <brownrig at ucar.edu> a
>> écrit :
>>
>>> Did you add this line ath the top, as per the documentation?
>>>
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
>>>
>>> https://www.ncl.ucar.edu/Document/Functions/User_contributed/time_axis_labels.shtml
>>>
>>>
>>>
>>>
>>>
>>> On Tue, Dec 11, 2018 at 10:21 AM Amal Inge <amalingenieur89 at gmail.com>
>>> wrote:
>>>
>>>> hi Carl,
>>>> i made some modification in the script attached but I had this error;
>>>>
>>>> fatal:syntax error: line 49 in file xy.ncl before or near ; sets the
>>>> correct time labels
>>>>
>>>> time_axis_labels(x, res, restime) ; sets the correct time labels
>>>> ^
>>>>
>>>> fatal:syntax error: possibly an undefined procedure
>>>> fatal:Syntax Error in block, block not executed
>>>> fatal:error at line 52 in file xy.ncl
>>>>
>>>>
>>>>
>>>> Le mar. 11 déc. 2018 à 14:47, Carl Schreck <cjschrec at ncsu.edu> a
>>>> écrit :
>>>>
>>>>> Please see
>>>>> https://www.ncl.ucar.edu/Document/Functions/User_contributed/time_axis_labels.shtml
>>>>> and the examples therein.
>>>>>
>>>>> Does it work if you uncomment line 49? If not, can you be more
>>>>> specific on what "doesn't work"?
>>>>>
>>>>> On Tue, Dec 11, 2018 at 3:24 AM Amal Inge <amalingenieur89 at gmail.com>
>>>>> wrote:
>>>>>
>>>>>>
>>>>>> Dear NCL experts,
>>>>>>
>>>>>> I want to plot a time series of monthly data of nc file with the
>>>>>> script attached but it didn't work, i think that I should convert the time
>>>>>> "since seconds" to month-year.
>>>>>> how could i do this please?
>>>>>>
>>>>>> many thanks
>>>>>> Amal
>>>>>>
>>>>>> netcdf dox01_med_0-52 {
>>>>>> dimensions:
>>>>>> time = UNLIMITED ; // (215 currently)
>>>>>> lev = 13 ;
>>>>>> lat = 253 ;
>>>>>> lon = 670 ;
>>>>>> variables:
>>>>>> double time(time) ;
>>>>>> time:axis = "T" ;
>>>>>> time:calendar = "standard" ;
>>>>>> time:units = "seconds since 1970-01-01 00:00:00" ;
>>>>>> time:long_name = "time" ;
>>>>>> time:standard_name = "time" ;
>>>>>> float lev(lev) ;
>>>>>> lev:_CoordinateZisPositive = "down" ;
>>>>>> lev:_CoordinateAxisType = "Height" ;
>>>>>> lev:axis = "Z" ;
>>>>>> lev:positive = "down" ;
>>>>>> lev:units = "m" ;
>>>>>> lev:long_name = "depth" ;
>>>>>> lev:standard_name = "depth" ;
>>>>>> float lat(lat) ;
>>>>>> lat:axis = "Y" ;
>>>>>> lat:units = "degrees_north" ;
>>>>>> lat:long_name = "latitude" ;
>>>>>> lat:standard_name = "latitude" ;
>>>>>> float lon(lon) ;
>>>>>> lon:axis = "X" ;
>>>>>> lon:units = "degrees_east" ;
>>>>>> lon:long_name = "longitude" ;
>>>>>> lon:standard_name = "longitude" ;
>>>>>> float dox(time, lev, lat, lon) ;
>>>>>> dox:missing_value = 1.e+20f ;
>>>>>> dox:_ChunkSizes = 1, 22, 84, 161 ;
>>>>>> dox:units = "millimol m-3" ;
>>>>>> dox:long_name = "Mole concentration of Dissolved Molecular
>>>>>> Oxygen in sea water" ;
>>>>>> dox:standard_name =
>>>>>> "mole_concentration_of_dissolved_molecular_oxygen_in_sea_water" ;
>>>>>> dox:_FillValue = 1.e+20f ;
>>>>>>
>>>>>> // global attributes:
>>>>>> :creation_date = "Tue Dec 4 23:27:50 CET 2018" ;
>>>>>> :Conventions = "None" ;
>>>>>> :source_file = "dox_med_0-52.nc" ;
>>>>>> :title = "NCL Efficient Approach to netCDF Creation" ;
>>>>>> }
>>>>>>
>>>>>> _______________________________________________
>>>>>> ncl-talk mailing list
>>>>>> ncl-talk at ucar.edu
>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> <https://ncics.org/> *Carl J. Schreck III, PhD*
>>>>> *Research Scholar*
>>>>> North Carolina State University <http://ncsu.edu/>
>>>>> North Carolina Institute for Climate Studies (NCICS)
>>>>> <https://ncics.org/>
>>>>> 151 Patton Ave, Asheville, NC 28801
>>>>> e: cjschrec at ncsu.edu
>>>>> o: +1 828 257 3140 <(828)%20257-3140>
>>>>> c: +1 828 484 1702 <(828)%20484-1702>
>>>>> Publications
>>>>> <http://scholar.google.com/citations?hl=en&user=th8ONEcAAAAJ&view_op=list_works&sortby=pubdate>
>>>>> ncics.org/mjo
>>>>> CycloneCenter.org <https://www.cyclonecenter.org/>
>>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181211/6b50a20e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resources.png
Type: image/png
Size: 65712 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181211/6b50a20e/attachment.png>
More information about the ncl-talk
mailing list