[ncl-talk] plotting monthly climatology form hourly data

Dennis Shea shea at ucar.edu
Thu Nov 7 18:06:28 MST 2019


The issue is the variable "time". This a subtle issue.

  f        = *addfile*("khuzetan_DUST04.2000010100.nc", "r")
  time  = f->time
  timeb = f->time_bnds

  ymdh_tag = *cd_calendar*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_calendar.shtml>(time
     ,-3)
  ymdh_Strt= *cd_calendar*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_calendar.shtml>(timeb(:,0),-3)
; beginning time 'bound'
  ymdh_Last= *cd_calendar*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_calendar.shtml>(timeb(:,1),-3)
; ending time 'bound'

  print(timeb(:,0)+"  "+timeb(:,1)+"  "+time+"  " \
       +ymdh_Strt +"  "+ymdh_Last +"  "+ymdh_tag)
=============
One month of time values. Here 124 (31*4) January hours.

(0)     timeb_0  timeb_1   time       ymdh_Strt    ymdh_Last       ymdh_tag
          439032  439038  439038  2000*010100*  2000*010106*  2000*010106*
*                :            :             :
:                     :                    :*
(123) 439770  439776  439776  2000*013118*  2000*020100*  2000
*020100*
===============

*The last tag value [timeb(:,1)] for the month of JANUARY is FEBRUARY  !!!
*

*My personal view is that this is not the appropriate time tag. *

*Rather, the timeb(:,0)]  should be used. *
================

In a nutshell, the work-around is to reassign the time coordinate
associated with each variable.

  timebnd = a[:]->time_bnds
  time0   = timebnd(:,0)                        ; extract the start bound
  [SNIP]
  x  = a[:]->emflx                     ; read emission flux from all files
  x&time = time0                     ; reassign original 'tag' time
[SNIP]
  u = b[:]->uas(:,0,:,:)              ; read U from all files
  u&time = time0                     ; reassign original 'tag' time

  v = b[:]->vas(:,0,:,:)              ; read V from all files
  v&time = time0                     ; reassign original 'tag' time

=========
Comments:
[0] You MUST examine the time variable more carefully.
      Using yyyymmdd start/stop dates is not appropriate for yyyymmddhh.
[1] You do *not *have to compute the daily mean values
[2] *calculate_monthly_values*
<http://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_monthly_values.shtml>
will accept 6-hrly data
[3] *http://www.ncl.ucar.edu/Applications/rcm.shtml*
<http://www.ncl.ucar.edu/Applications/rcm.shtml>
Examples 5,6,7: illustrate how to plot variables for the Regional Climate
Model (RCM).
=========
See Attached


On Thu, Nov 7, 2019 at 6:10 AM Setareh Rahimi via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Dear all,
>
> I need to plot the monthly average from a model output, which gives me
> 4times data per day( at 00, 06,12,18). So I first need to convert hourly
> data tp daily data and then convert to monthly. And finally calculates the
> climatology average of those monthly data from 2000-2014.
> However, once I ran my script I faced some error:
> 1. I did not have data for 2015, but when using print (yyyymmdd)   year
> 2015 printed. ( please have a look at the attachment number 1)
> 2. After reading variable x this warning comes up: Aggregated dimension
> coordinate values are non-monotonic; check aggregated file ordering
> (warning attached)
> 3. Once using clmMonTLL function ( available on :
> https://www.ncl.ucar.edu/Applications/Scripts/climo_3.ncl), NCL tells
> that :  clmMonTLL: dimension must be a multiple of 12 . I just wonder why
> this happened. I used 15 years with 12 months for each year!! ( attached)
> I attached the script and data for the year 2000. Could you please kindly
> guide me what are my mistakes?
> Best wishes,
>  str.zip
> <https://drive.google.com/file/d/12-n6pQ4JF6nwIRBVW4iaTKaznfP1FGet/view?usp=drive_web>
>
> --
> S.Rahimi
>
> _______________________________________________
> 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/20191107/1e376190/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dust.ncl_talk
Type: application/octet-stream
Size: 8601 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191107/1e376190/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: monthly_climatology.2000-2000.png
Type: image/png
Size: 344525 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191107/1e376190/attachment-0001.png>


More information about the ncl-talk mailing list