[1] Please examine the error message [as previously suggested by
Mary in another response]
[2] always read the function documentation.
Prior to the do loop *you* defined
rmsdTime925=new((/nvtimes/),"float") ; named RMS array
This is one dimensional.
The offending statement:
rmsdTime925(nt) =
dim_rmsd_Wrap(FNLv925(lat|:,lon|:,time|(nt)),V925(lat|:,lon|:,time|(nt)))
The error message:
"fatal:Dimension sizes on right hand side of assignment do not match
dimension sizes of left hand side"
To debug you should look at the error message and say to yourself
"Ummm, I have specified that the left hand side is size 1 [a scalar]
rmsdTime925(nt)
The error message says that the right hand size does not match
this expectation. I should read the documentation which has several
example illustrating returned dimension sizes or I can debug myself
Just before the offending statement I'll add
debug =
dim_rmsd_Wrap(FNLv925(lat|:,lon|:,time|(nt)),V925(lat|:,lon|:,time|(nt)))
printVarSummary(debug)
You will see that "debug" is not a scalar as you expect.
Finally,
dim_rmsd_Wrap(FNLv925(lat|:,lon|:,time|(nt)),V925(lat|:,lon|:,time|(nt)))
the last argument is a scalar [ time(nt) ]. The dim_rmsd expects an vector
as the rhs so, in essense, your statement reduces to
dim_rmsd_Wrap(FNLv925(lat|:,lon|:),V925(lat|:,lon|:))
====
If you want an unweighted spatial rmsd at each time step
and nlat and mlon are the size of the lat and lon dimensions,
and you want to keep it in the loop
dum1 = onedtond( ndtooned(FNLv925(nt,:,:)), (/1, nlat*mlon/))
dum2 = onedtond( ndtooned(v925(nt,:,:)) , (/1, nlat*mlon/))
rmsdTime925(nt) = dim_rmsd_Wrap(dum1,dum2)
Erik Noble wrote:
> I am following onto this question:
> I used named subscripting in my code and it worked.
> I tried using the dim dim_rmsd_Wrap function and I received only this error:
>
> Copyright (C) 1995-2007 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.0.0
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
>
> fatal:Dimension sizes on right hand side of assignment do not match
> dimension sizes of left hand side
> fatal:Execute: Error occurred at or near line 86 in file test_script2.ncl
>
>
> In the code where the error occurs is
> ; Rename dimensions for clarity's sake
> FNLv925!0 = "time"
> FNLv925!1 = "lat"
> FNLv925!2 = "lon"
> FNLv700!0 = "time"
> FNLv700!1 = "lat"
> FNLv700!2 = "lon"
> V925!0 = "time"
> V925!1 = "lat"
> V925!2 = "lon"
> V700!0 = "time"
> V700!1 = "lat"
> V700!2 = "lon"
> rmsdTime925=new((/nvtimes/),"float") ; named RMS array
>
> ; Correlation
> do nt = 0, nvtimes-1
> fin925_R_arr(nt) = escorc(ndtooned(V925(nt,:,:)),ndtooned(FNLv925(nt,:,:)))
> fin700_R_arr(nt) = escorc(ndtooned(V700(nt,:,:)),ndtooned(FNLv700(nt,:,:)))
> ; RMS Error
> rmsdTime925(nt) = dim_rmsd_Wrap(
> FNLv925(lat|:,lon|:,time|(nt)),V925(lat|:,lon|:,time|(nt)))
> end do
>
> How does my rms function differ that far from the example (at
> http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_rmsd_Wrap.shtml)
> to where I am getting a dimension size error?
>
>
> On 2/6/08 10:41 PM, "Erik Noble" <enoble_at_giss.nasa.gov> wrote:
>
>
>> Hi.
>> I want to compute the temporal root-mean-square-difference at each
>> latitude/longitude grid point and I know that I have to follow the NCL's
>> named subscripting to reorder the input array such that "time" is the
>> rightmost dimension, such that
>> rmsdTime = dim_rmsd( x(lat|:,lon|:,time|:), y(lat|:,lon|:,time|:) )
>>
>> But my two variables are:
>>
>> Variable: V925
>> Type: float
>> Total Size: 3636240 bytes
>> 909060 values
>> Number of Dimensions: 3
>> Dimensions and sizes: [60] x [109] x [139]
>> Coordinates:
>> Number Of Attributes: 4
>> PlotLevelID : 925 hPa
>> units : m/s
>> description : v Velocity
>> _FillValue : -999999
>>
>>
>> Variable: FNLv925
>> Type: float
>> Total Size: 3636240 bytes
>> 909060 values
>> Number of Dimensions: 3
>> Dimensions and sizes: [60] x [south_north_stag | 109] x [west_east | 139]
>> Coordinates:
>> Number Of Attributes: 6
>> stagger : V
>> description : V
>> units : m s-1
>> MemoryOrder : XYZ
>> FieldType : 104
>> _FillValue : -999
>>
>>
>> Since, FNLv925's dimensions have names and V925's dimensions do not, in
>> order to root-mean-square-difference at each latitude/longitude grid point,
>> do I need to add extra dimension names to V925?
>> Thank you.
>> -Erik
>>
>>
>> _______________________________________________
>> 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
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Feb 07 2008 - 07:01:54 MST
This archive was generated by hypermail 2.2.0 : Thu Feb 07 2008 - 08:58:57 MST