x(time,lat,lon):
No automatic way that I can think of
xAvg = x(0:0,:,:) ; (1,lat,lon) =>
0:0 forces time dimension
xAvg(0,:,:) = (/ dim_avg(x(lat|:,lon|:,time|79:98) /)
printVarSummary(xAvg)
Jeanne Thibeault wrote:
> Hello NCL,
>
> Is there an easy way to prevent dimension reduction when calculating
> the average of a 3D variable? Or is there a way to convert the
> resulting 2D variable back to a 3D variable? A portion of my script
> is below.
>
> B1cdd8099CNRM = cddCNRM_19012099B1(79:98,:,:)
> copy_VarAtts(cdd20CNRM,B1cdd8099CNRM)
> printVarSummary(B1cdd8099CNRM)
>
> nlatCNRM = 64
> nlonCNRM = 128
> ntime = 1
> meanB1cdd8099CNRM = dim_avg_Wrap(B1cdd8099CNRM(lat|:, lon|:, time|:))
> printVarSummary(meanB1cdd8099CNRM)
> B1CDD8099CNRMmean = meanB1cdd8099CNRM(0:0,:,:) ******this line is
> producing an error
> B1CDD8099CNRMmean = new((/ntime,nlatCNRM, nlonCNRM/), typeof
> (meanB1cdd8099CNRM), meanB1cdd8099CNRM@_FillValue)
>
> fatal:Number of subscripts on rhs do not match number of dimensions
> of variable,
> (3) Subscripts used, (2) Subscripts expected
>
>
> Thanks for your help,
> Jeanne
>
>
>
>
> Variable: B1cdd8099CNRM
> Type: float
> Total Size: 655360 bytes
> 163840 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 20] x [lat | 64] x [lon | 128]
> Coordinates:
> time: [44012..50951]
> lat: [-87.86380004882812..87.86380004882812]
> lon: [ 0..357.1875]
> Number Of Attributes: 5
> original_name : pxcdd
> missing_value : 1e+20
> _FillValue : 1e+20
> units : days
> long_name : Maximum Number of Consecutive Dry Days
>
>
> Variable: meanB1cdd8099CNRM
> Type: float
> Total Size: 32768 bytes
> 8192 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat | 64] x [lon | 128]
> Coordinates:
> lat: [-87.86380004882812..87.86380004882812]
> lon: [ 0..357.1875]
> Number Of Attributes: 6
> long_name : Maximum Number of Consecutive Dry Days
> units : days
> _FillValue : 1e+20
> missing_value : 1e+20
> original_name : pxcdd
> average_op_ncl : dim_avg over dimension: time
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-- ====================================================== Dennis J. Shea tel: 303-497-1361 | P.O. Box 3000 fax: 303-497-1333 | Climate Analysis Section | Climate & Global Dynamics Div. | National Center for Atmospheric Research | Boulder, CO 80307 | USA email: shea 'at' ucar.edu | ====================================================== _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Mon Sep 21 2009 - 14:04:20 MDT
This archive was generated by hypermail 2.2.0 : Thu Sep 24 2009 - 13:55:09 MDT