[ncl-talk] Best way to add time dimension after using dim_avg_n_Wrap

Herbster, Christopher G. herbstec at erau.edu
Mon Oct 5 20:16:53 MDT 2015


Thanks Dennis!

This is exactly what I need, thanks!

I had tried something similar, but I didn't have the correct steps nor all the pieces.

The only thing I had to add to your suggestion was a short2flt conversion when making the array for the averages.

Thanks for the help, I really appreciate your input.

Chris Herbster

-- 

 Dr. Christopher G. Herbster
 Associate Professor
 Director of Science and Technology
 for the ERAU Weather Center
 Applied Aviation Sciences
 Embry-Riddle Aeronautical Univ.
 600 S. Clyde Morris Blvd.
 Daytona Beach, FL 32114-3900
 
 386.226.6444 Office
 386.226.6446 Weather Center
 http://wx.erau.edu/

Schedule at:  http://wx.erau.edu/faculty/herbster/Schedules/

-----Original Message-----
From: Dennis Shea [mailto:shea at ucar.edu] 
Sent: Monday, October 05, 2015 6:26 PM
To: Herbster, Christopher G. <herbstec at erau.edu>
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] Best way to add time dimension after using dim_avg_n_Wrap

One approach

  avg_ir = irwin_cdr(0:0,:,:)      ; pre-create singleton time
dimension; with meta data
  printVarSummary(avg_ir)     ; informational purposes (time,lat,lon) ... ntim=1

  avg_ir(0,:,:)   = (/ dim_avg_n(irwin_cdr, 0) /)   ; fill
preallocated space with averages
  printVarSummary(avg_ir)                                ;

[1] No need for _Wrap here

[2] The (/.../) means transfer values only

[3] original data overwritten with averages

[4] Array will be associate with the 1st day of the month

HTH
D

On Mon, Oct 5, 2015 at 3:58 PM, Herbster, Christopher G.
<herbstec at erau.edu> wrote:
> Hi folks,
>
>
>
> I have a gridded dataset that I am creating monthly averages at all 
> lat/lon locations.
>
>
>
> I have used the “addfiles” method to open all the files from a month 
> that are valid at a particular UTC time, like 12 UTC for example.  The 
> month I was working on is September, so there are 30 files at that time.
>
>
>
> The input variable has these properties:
>
>
>
> Variable: irwin_cdr
>
> Type: short
>
> Total Size: 33535800 bytes
>
>             16767900 values
>
> Number of Dimensions: 3
>
> Dimensions and sizes:    [time | 30] x [lat | 601] x [lon | 930]
>
>
>
> If I use the following code to get the averages at the locations, 
> things work just fine, except that I no longer have a time reference for the data.
>
>
>
> avg_ir = dim_avg_n_Wrap(irwin_cdr,0)
>
>
>
> Variable: avg_ir
>
> Type: float
>
> Total Size: 2235720 bytes
>
>             558930 values
>
> Number of Dimensions: 2
>
> Dimensions and sizes:    [lat | 601] x [lon | 930]
>
>
>
> What I would like to do is assign a time to this monthly average 
> before I write the data to a new NetCDF file.  That way I can open a 
> group of files in an application, like the Unidata IDV, and animate the results.
>
>
>
> When creating a monthly average what is the “best practice” method of 
> assigning a time to the results?  I was thinking of just using the 
> first time of the group of files (i.e. the first day of the month at 
> that UTC hour), but if there is a standard I’d like to follow that.
>
>
>
> Any guidance is welcome.
>
>
>
> Thanks,
>
> Chris Herbster
>
>
>
> --
>
>
>
> Dr. Christopher G. Herbster
>
> Associate Professor
>
> Director of Science and Technology
>
> for the ERAU Weather Center
>
> Applied Aviation Sciences
>
> Embry-Riddle Aeronautical Univ.
>
> 600 S. Clyde Morris Blvd.
>
> Daytona Beach, FL 32114-3900
>
>  386.226.6444 Office
>
> 386.226.6446 Weather Center
>
> http://wx.erau.edu/
>
>
>
> Schedule at:  http://wx.erau.edu/faculty/herbster/Schedules/
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


More information about the ncl-talk mailing list