[ncl-talk] average for two variables in ncl
Dennis Shea
shea at ucar.edu
Thu Mar 3 13:42:44 MST 2016
When you get this type of error, you can debug by adding the following
*before* the statement that causes the error.
printVarSummary(dailyT2avg(ifil,:,:))
test_0 = dim_max_n(temp,0)
printVarSummary(test_0)
test_1 = (dim_max_n_Wrap(temp,0)+dim_min_n_Wrap(temp,0))/2.0
printVarSummary(test_1)
Look at the dimension sizes
dailyT2avg(ifil,:,:) = (dim_max_n_Wrap(temp,0)+dim_min_n_Wrap(temp,0))/2.0
===
Further you gain nothing by using the _Wrap versions of the code. The
computations eliminate meta data.
dailyT2avg(ifil,:,:) = (dim_max_n_Wrap(temp,0)+dim_min_n_Wrap(temp,0))/2.0
===
I suggest
tavg = (dim_max_n(temp,0) + dim_min_n(temp,0))/2.0
printVarSummary(tavg) ' look at dimensionality
On Thu, Mar 3, 2016 at 12:58 PM, Ashish Sharma <asharma7 at nd.edu> wrote:
> Hi users,
>
> I am trying to do a simple average. Rather than using "dim_vg_n_Wrap", I
> need to do average of maximum and minimum values.
>
> Can I not do average like this?
>
> dailyT2avg(ifil,:,:) = (dim_max_n_Wrap(temp,0)+dim_min_n_Wrap(temp,0))/2.0
>
> It is giving me the following error.
>
> fatal:Dimension size mismatch on subscript #1, left-hand and right-hand
> side dimensions do not match
>
>
> best,
> Ashish
>
> _______________________________________________
> 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/20160303/db0d36bf/attachment.html
More information about the ncl-talk
mailing list