[ncl-talk] Month_to_annual with no time dimension attributes nor coordinates

Sri Nandini snandini at marum.de
Tue Jan 23 00:49:06 MST 2018


Hello

The problem was solved once i defined the year dimension:
  xEqv = equiv_sample_size (T2M(lat|:,lon|:,year|:), sigr,0)   

 copy_VarMeta(aveX,xEqv)
printVarSummary(xEqv)                                 ; (lat,lon) 

THank you


On Jan 22, 2018 10:00:34 PM, Rick Brownrigg wrote:

> Hi,
> 
> It appears that month_to_annua() has changed the temporal dimension to "year".  I don't know enough about what you are doing, but is it appropriate to simply change "time" to "year" in the dimension reordering in the call to equiv_sample_size()?
> 
> Hope that helps...
> Rick

> On Mon, Jan 22, 2018 at 1:49 PM, Sri Nandini via ncl-talk > <> ncl-talk at ucar.edu> >>  wrote:
> > Hello
> > 
> > I am trying to make estimates the number of independent values of a series of correlated
observations using equiv_sample_size based on annual values of my temperature which is below in part of script. However, i keep getting the error:(time) is not a dimension name in variable (t44), could not determine dimension number
> > 
> > My simple script is below:
> > 
> > 
> > 
> > 
> > ; ==============================================================
> > ; Open the file: Read only the user specified period 
> > ; ==============================================================
> > f= addfile("T2M_Cam5.nc", "r") ;Model Control
> > TIME   = f->time
> > ;YYYY   = cd_calendar(TIME,-1)/100                 ; entire file
> > ;iYYYY  = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)
> > T41    = f->TREFHT(:,:,:)
> > printVarSummary(T41)                                ; (time, lat,lon)
> > T4    = lonFlip(T41)
> > ;printVarSummary(T4)                                ; (time, lat,lon)
> > T4 at _FillValue = -9.96921e+36
> > t44 = month_to_annual(T4, 0)                   ;; average over the 0th dim
> > printVarSummary(t44)                                ; (lat,lon)
> > aveX = dim_avg_n_Wrap(t44, 0)                   ;; average over the 0th dim
> > printVarSummary(aveX)                                ; (lat,lon)
> > varX = dim_variance_n_Wrap(t44,0) ; compute variance
> > printVarSummary(varX)                                ; (lat,lon) 
> > ;================================================================================
> > ;equiv_sample_size: Estimates the number of independent values of a series of correlated observations. Specify a critical significance level to test the lag-one auto-correlation coefficient 
> > ;=================================================================================
> >   sigr = 0.05                        ; critical sig lvl for r
> > 
> >  xEqv = new(dimsizes(aveX),typeof(aveX),aveX at _FillValue)
> > printVarSummary(xEqv)                               ; (lat,lon)
> >   xEqv = equiv_sample_size (t44(lat|:,lon|:,time|:), sigr,0)   
> >  copy_VarMeta(aveX,xEqv)
> > printVarSummary(xEqv)                               ; (lat,lon)
> > 
> > ;=================================================================
> > The output of running that is here:
> > 
> > Variable: T41
> > Type: float
> > Total Size: 403439616 bytes
> >             100859904 values
> > Number of Dimensions: 3
> > Dimensions and sizes:    [time | 1824] x [lat | 192] x [lon | 288]
> > Coordinates: 
> >             time: [  31..55480]
> >             lat: [ -90..  90]
> >             lon: [   0..358.75]
> > Number Of Attributes: 3
> >   units :    K
> >   long_name :    Reference height temperature
> >   cell_methods :    time: mean
> > 
> > Variable: t44
> > Type: float
> > Total Size: 33619968 bytes
> >             8404992 values
> > Number of Dimensions: 3
> > Dimensions and sizes:    [year | 152] x [lat | 192] x [lon | 288]
> > Coordinates: 
> >             lat: [ -90..  90]
> >             lon: [-180..178.75]
> > Number Of Attributes: 6
> >   _FillValue :    -9.96921e+36
> >   units :    K
> >   long_name :    Reference height temperature
> >   cell_methods :    time: mean
> >   lonFlip :    longitude coordinate variable has been reordered via lonFlip
> >   NCL :    month_to_annual
> > 
> > Variable: aveX
> > Type: float
> > Total Size: 221184 bytes
> >             55296 values
> > Number of Dimensions: 2
> > Dimensions and sizes:    [lat | 192] x [lon | 288]
> > Coordinates: 
> >             lat: [ -90..  90]
> >             lon: [-180..178.75]
> > Number Of Attributes: 7
> >   _FillValue :    -9.96921e+36
> >   units :    K
> >   long_name :    Reference height temperature
> >   cell_methods :    time: mean
> >   lonFlip :    longitude coordinate variable has been reordered via lonFlip
> >   NCL :    month_to_annual
> >   average_op_ncl :    dim_avg_n over dimension(s): year
> > 
> > Variable: varX
> > Type: float
> > Total Size: 221184 bytes
> >             55296 values
> > Number of Dimensions: 2
> > Dimensions and sizes:    [lat | 192] x [lon | 288]
> > Coordinates: 
> >             lat: [ -90..  90]
> >             lon: [-180..178.75]
> > Number Of Attributes: 7
> >   _FillValue :    -9.96921e+36
> >   units :    K
> >   long_name :    Reference height temperature
> >   cell_methods :    time: mean
> >   lonFlip :    longitude coordinate variable has been reordered via lonFlip
> >   NCL :    month_to_annual
> >   variance_op_ncl :    dim_variance_n over dimension(s): year
> > 
> > Variable: xEqv
> > Type: float
> > Total Size: 221184 bytes
> >             55296 values
> > Number of Dimensions: 2
> > Dimensions and sizes:    [192] x [288]
> > Coordinates: 
> > Number Of Attributes: 1
> >   _FillValue :    -9.96921e+36
> > fatal:(time) is not a dimension name in variable (t44), could not determine dimension number
> > fatal:["Execute.c":8575]:Execute: Error occurred at or near line 35 in file testing_T2M.ncl
> > 
> > 
> > Variable: xEqv
> > Type: float
> > Total Size: 221184 bytes
> >             55296 values
> > Number of Dimensions: 2
> > Dimensions and sizes:    [lat | 192] x [lon | 288]
> > Coordinates: 
> >             lat: [ -90..  90]
> >             lon: [-180..178.75]
> > Number Of Attributes: 7
> >   average_op_ncl :    dim_avg_n over dimension(s): year
> >   NCL :    month_to_annual
> >   lonFlip :    longitude coordinate variable has been reordered via lonFlip
> >   cell_methods :    time: mean
> >   long_name :    Reference height temperature
> >   units :    K
> >   _FillValue :    -9.96921e+36
> > 
> > ;=========================================================
> > Because, upon using month_to_annual i dont get time dimension nor attributes i cannot perform further analysis as it says i havnt defined time dimension. I have tried to use several methods by defining new varible, as well as VarMeta, VarCoords etc, but it doesnt change the outcome.
> > 
> > Can someone please advice on how to workaround this issue?
> > The bottom line being i need to use equiv_sample_size on my annual values and i cannot due to time dimension not being defined.
> > Much appreciated 
> > 
> > 

> > _______________________________________________
> > 
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/20180123/fa41431f/attachment.html>


More information about the ncl-talk mailing list