[ncl-talk] warning:Dimension (0) has not been defined when use dim_stddev_n_Wrap

Alan Brammer abrammer at albany.edu
Fri Feb 10 08:59:21 MST 2017


Because you’re using ****_Wrap() the function tries to take information about the dimension it is operating on and attach that information to the new variable. 

e.g. if you averaged over a dimension named time: the new variable will have the below attribute.  
average_op_ncl :	dim_avg_n over dimension(s): time

You could define T_plane (and others) to have a coordinate name for the left most dimension but it doesn’t matter to the result. 

> T_plane   = new((/ens_size,dimy,dimx/),"float”)
T_plane!0 = “ensembles”




Alan





##############################
Alan Brammer,
Post-Doc Researcher

Department of Atmospheric and Environmental Sciences,
University at Albany, State University of New York, Albany, NY, 12222
abrammer at albany.edu
##############################

> On 9 Feb 2017, at 21:56, qiuxiaobin.tj <qiuxiaobin.tj at qq.com> wrote:
> 
> Hi All
> 
> I always met a warning:
> Dimension (0) has not been defined 
> when use  dim_stddev_n_Wrap or dim_variance_n_Wrap to compute ensemble std or var on given height. I'm not sure about the result calculate from dim_stddev_n_Wrap. Does anyone has met this warning and give me some advise? Thanks a lot. 
> 
> -------------------------------------------------------------------------------
> Here is the output
> 
>  Copyright (C) 1995-2015 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 6.3.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
> (0)	================================================================
> (0)	Time 2013-05-31_21:00:00 0
> (0)	Read in prior
> 
> 
> Variable: fils
> Type: string
> Total Size: 16 bytes
>             2 values
> Number of Dimensions: 1
> Dimensions and sizes:	[2]
> Coordinates: 
> (0)	/home/qiuxb/WRF_DART/Data/20130531/CONV_12/Plot/WRFOUT/wrffcst_d01_2013-05-31_21:00:00_1
> (1)	/home/qiuxb/WRF_DART/Data/20130531/CONV_12/Plot/WRFOUT/wrffcst_d01_2013-05-31_21:00:00_2
> warning:Dimension (0) has not been defined
> (0)	Read in post
> 
> 
> Variable: fils
> Type: string
> Total Size: 16 bytes
>             2 values
> Number of Dimensions: 1
> Dimensions and sizes:	[2]
> Coordinates: 
> (0)	/home/qiuxb/WRF_DART/Data/20130531/CONV_12/Plot/WRFOUT/wrfout_d01_2013-05-31_21:00:00_1
> (1)	/home/qiuxb/WRF_DART/Data/20130531/CONV_12/Plot/WRFOUT/wrfout_d01_2013-05-31_21:00:00_2
> warning:Dimension (0) has not been defined
> (0)	------------------temp------------------
> 
> -------------------------------------------------------------------------------
> Here is the scripts
> 
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> 
> ;-----------------------------------------------------------------------------------------
> 
> begin
> 
> ;-----------------------------------------------------------------------------------------
> 
> wrfout_dir = "/home/qiuxb/WRF_DART/Data/20130531/CONV_12/Plot/WRFOUT"
> plot_dir   = "/home/qiuxb/WRF_DART/Data/20130531/CONV_12/Plot/WRFOUT"
> 
> prior_post_name = (/ "fcst", "out" /)
> 
> dimx = 250
> dimy = 200
> dimz = 50
> ens_size = 2
> 
> x_start = 80; 75
> x_end   =  dimx - 75 ;dimx-60
> y_start = 65 ;60
> y_end   = dimy-60 ;dimy-50
> 
> type = "png"
> wks  = gsn_open_wks(type, plot_dir + "/ens_spread" )     ; open a ps file
> 
> ntimes = 1
> time_ini = "20130531210000"
> time_intvl = 5 ; minute
> 
> z_intvl = (/ 1, 5, 10, 15, 20, 22, 24, 26, 30, 33 /)
> height = 2000 ; msl  
> 
> ;gsn_define_colormap(wks,"BlGrYeOrReVi200")
> gsn_define_colormap(wks,"WhBlGrYeRe")
> 
> z_mem     = new((/dimz,dimy,dimx/),"float") ; grid point height
> dbz_mem   = new((/ens_size,dimz,dimy,dimx/),"float")
> dbz_plane = new((/ens_size,dimy,dimx/),"float")
> dbz_prior = new((/dimy,dimx/),"float")
> dbz_post  = new((/dimy,dimx/),"float")
> T_mem     = new((/ens_size,dimz,dimy,dimx/),"float")
> T_plane   = new((/ens_size,dimy,dimx/),"float")
> T_prior   = new((/dimy,dimx/),"float")
> T_post    = new((/dimy,dimx/),"float")
> P_mem     = new((/ens_size,dimz,dimy,dimx/),"float")
> P_plane   = new((/ens_size,dimy,dimx/),"float")
> P_prior   = new((/dimy,dimx/),"float")
> P_post    = new((/dimy,dimx/),"float")
> Q_mem     = new((/ens_size,dimz,dimy,dimx/),"float")
> Q_plane   = new((/ens_size,dimy,dimx/),"float")
> Q_prior   = new((/dimy,dimx/),"float")
> Q_post    = new((/dimy,dimx/),"float")
> U_mem     = new((/ens_size,dimz,dimy,dimx/),"float")
> U_plane   = new((/ens_size,dimy,dimx/),"float")
> U_prior   = new((/dimy,dimx/),"float")
> U_post    = new((/dimy,dimx/),"float")
> V_mem     = new((/ens_size,dimz,dimy,dimx/),"float")
> V_plane   = new((/ens_size,dimy,dimx/),"float")
> V_prior   = new((/dimy,dimx/),"float")
> V_post    = new((/dimy,dimx/),"float")
> W_mem     = new((/ens_size,dimz,dimy,dimx/),"float")
> W_plane   = new((/ens_size,dimy,dimx/),"float")
> W_prior   = new((/dimy,dimx/),"float")
> W_post    = new((/dimy,dimx/),"float")
> ;-----------------------------------------------------------------------------------------
> time_wrf = systemfunc("da_advance_time.exe " + time_ini + " " + "0m -w")
> fin = addfile(wrfout_dir + "/wrfout_d01_" + time_wrf + "_1" + ".nc","r")
> z = wrf_user_getvar(fin, "z",0)        ; grid point height
> XLAT  = wrf_user_getvar(fin, "XLAT",0)
> XLONG = wrf_user_getvar(fin, "XLONG",0)
> 
> do tm = 0,ntimes-1
>     time_wrf = systemfunc("da_advance_time.exe " + time_ini + " " + tostring(time_intvl * tm) + "m -w")
>     print( "================================================================" )
>     print( "Time " + time_wrf + " " + tm) 
> 
>     print( "Read in prior" )
>     fils = systemfunc("ls " + wrfout_dir + "/wrffcst_d01_" + time_wrf + "_*")
>     print(fils)
>     f = addfiles(fils + ".nc","r")
> 
>     do j=0, ens_size - 1
>         z_mem(:,:,:)     = wrf_user_getvar(f[j], "z",0)
>         dbz_mem(j,:,:,:) = wrf_user_getvar(f[j],"REFL_10CM",0)
>         T_mem(j,:,:,:)   = wrf_user_getvar(f[j],"T",0)
>         P_mem(j,:,:,:)   = wrf_user_getvar(f[j],"P",0)
>         Q_mem(j,:,:,:)   = wrf_user_getvar(f[j],"QVAPOR",0)
>         U_mem(j,:,:,:)   = wrf_user_getvar(f[j],"ua",0)
>         V_mem(j,:,:,:)   = wrf_user_getvar(f[j],"va",0)
>         W_mem(j,:,:,:)   = wrf_user_getvar(f[j],"wa",0)
> 
>         dbz_plane(j,:,:) = wrf_user_intrp3d(dbz_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>         T_plane(j,:,:)   = wrf_user_intrp3d(T_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>         P_plane(j,:,:)   = wrf_user_intrp3d(P_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>         Q_plane(j,:,:)   = wrf_user_intrp3d(Q_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>         U_plane(j,:,:)   = wrf_user_intrp3d(U_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>         V_plane(j,:,:)   = wrf_user_intrp3d(V_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>         W_plane(j,:,:)   = wrf_user_intrp3d(W_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>     end do
> ;    dbz_prior(:,:) = dim_variance_n_Wrap(dbz_plane, 0)
>     T_prior   = dim_stddev_n_Wrap(T_plane, 0)
> ;    P_prior(:,:)   = dim_variance_n_Wrap(P_plane, 0)
> ;    Q_prior(:,:)   = dim_variance_n_Wrap(Q_plane, 0)
> ;    U_prior(:,:)   = dim_variance_n_Wrap(U_plane, 0)
> ;    V_prior(:,:)   = dim_variance_n_Wrap(V_plane, 0)
> ;    W_prior(:,:)   = dim_variance_n_Wrap(W_plane, 0)
> 
>     delete(fils)
>     delete(f)
>     z_mem = 0.0
>     dbz_mem = 0.0
>     T_mem = 0.0
>     P_mem = 0.0
>     Q_mem = 0.0
>     U_mem = 0.0
>     V_mem = 0.0
>     W_mem = 0.0
>     dbz_plane = 0.0
>     T_plane = 0.0
>     P_plane = 0.0
>     Q_plane = 0.0
>     U_plane = 0.0
>     V_plane = 0.0
>     W_plane = 0.0
> 
>     print( "Read in post" )
>     fils = systemfunc("ls " + wrfout_dir + "/wrfout_d01_" + time_wrf + "_*")
>     print(fils)
>     f = addfiles(fils + ".nc","r")
> 
>     do j=0, ens_size - 1
>         z_mem(:,:,:)     = wrf_user_getvar(f[j], "z",0)
>         dbz_mem(j,:,:,:) = wrf_user_getvar(f[j],"REFL_10CM",0)
>         T_mem(j,:,:,:)   = wrf_user_getvar(f[j],"T",0)
>         P_mem(j,:,:,:)   = wrf_user_getvar(f[j],"P",0)
>         Q_mem(j,:,:,:)   = wrf_user_getvar(f[j],"QVAPOR",0)
>         U_mem(j,:,:,:)   = wrf_user_getvar(f[j],"ua",0)
>         V_mem(j,:,:,:)   = wrf_user_getvar(f[j],"va",0)
>         W_mem(j,:,:,:)   = wrf_user_getvar(f[j],"wa",0)
> 
>         dbz_plane(j,:,:) = wrf_user_intrp3d(dbz_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>         T_plane(j,:,:)   = wrf_user_intrp3d(T_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>         P_plane(j,:,:)   = wrf_user_intrp3d(P_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>         Q_plane(j,:,:)   = wrf_user_intrp3d(Q_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>         U_plane(j,:,:)   = wrf_user_intrp3d(U_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>         V_plane(j,:,:)   = wrf_user_intrp3d(V_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>         W_plane(j,:,:)   = wrf_user_intrp3d(W_mem(j,:,:,:),z_mem(:,:,:),"h",height,0.,False)
>     end do
> ;    dbz_post (:,:) = dim_variance_n_Wrap(dbz_plane, 0)
>     T_post    = dim_stddev_n_Wrap(T_plane, 0)
> ;    P_post (:,:)   = dim_variance_n_Wrap(P_plane, 0)
> ;    Q_post (:,:)   = dim_variance_n_Wrap(Q_plane, 0)
> ;    U_post (:,:)   = dim_variance_n_Wrap(U_plane, 0)
> ;    V_post (:,:)   = dim_variance_n_Wrap(V_plane, 0)
> ;    W_post (:,:)   = dim_variance_n_Wrap(W_plane, 0)
> 
> end do
> end
> 
> Best,
> Xiaobin
> _______________________________________________
> 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/20170210/99faddc7/attachment.html 


More information about the ncl-talk mailing list