Re: Trying to Average Multiple Files

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 1 Aug 2007 12:16:44 -0600 (MDT)

*** I made some minor changes to the previous response ***

---
  So, I assume you have the following
  
      X  = f1- X    
      a1 = dim_avg_Wrap(X(south_north|:,west_east|:, Time|:) )
     ;detete(X)   ; only if each X has different Time dimension sizes
      X  = f2- X    
      b1 = dim_avg_Wrap(X(south_north|:,west_east|:, Time|:) )
  etc,
  
      Hence a1, b1, ... will have the time average for a specific period
      They will also be 2 dimensional since the time timension is degenerate
  eg
      printVarSummary( a1 )
  
  To get the overall time average
  
      xAVG = a1 + b1 +   ....    ; array syntax 
      xAVG_at_long_name = "..."
      xAVG_at_units     = X_at_units
  
  ------------
  
  An alternative is to use addfiles and addfiles_GetVar
  
  http://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
  http://www.ncl.ucar.edu/Document/Functions/Contributed/addfiles_GetVar.shtml
  
     diri = "..."   ; input directory
     fils = systemfunc ("ls "+diri+"wrf*.nc") ; file paths
  
     f    = addfiles (fils, "r")   
     X    = addfiles_GetVar(f,fils,"X")
  
     printVarSummary( X )
  
     xAVG = dim_avg_Wrap( X )
     printVarSummary( xAVG )
  
  ---------------
> good luck
> 
> 
>    
> 
>     
> On Wed, 1 Aug 2007, Sean Heuser wrote:
> 
> > Hello NCL Users,
> > I'm am working with a 2-month WRF simulation and I'm trying to get the
> > average temperature for the entire time frame.  Since computer time was
> > scarce, I have 9 input files(call them a,b,c,d,e,f,g,h,i) that span the
> > time frame.  I called the temperature variable for each(so I have 9 temp
> > variables called a1,b1,c1,etc.).  I tried using the dim_Avg function and
> > was successful with one variable.  For ex:
> > 
> > Avg = dim_Avg(a1(south_north|:, west_east|:, Time|:)
> > 
> > works. However, when I try it with more than one, it reads an error saying
> > that it only expects 1 subscript. Does anyone know how I can possibly do
> > an average with all of my temperature variables?  Any help would be
> > appreciated.  Thank you.
> > 
> > 
> > 
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> 
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Aug 01 2007 - 12:16:44 MDT

This archive was generated by hypermail 2.2.0 : Mon Aug 06 2007 - 08:08:45 MDT