[ncl-talk] Fw: area average

Dennis Shea shea at ucar.edu
Sun Aug 12 21:53:46 MDT 2018


The data values on  '*SMAP_L2_*SM_P_E_*h5' are from satellite *swaths*. "
*L2*"

The data variable ("soil_moisture") and the location variables: "latitude"
and  "longitude" are all *one-dimensional*. It looks like the swath values
and the associated latitude & longitude locations were just made into
one-dimensional arrays.

Your code comments the following:

*/;*
                            --37.80-----
                        |                       |
                   45.8                  46.03
                        |                       |
                            ---37.45----
*;/*

There is *no need *to perform and areal average when using such a small
area [specifically such a small latitudinal range]. .The following should
suffice:

       latS = 37.45
       latN = 37.80
       lonL = 45.8
       lonR = 4603

      sm    = f->soil_moisture   ; [*]
      lat     = f->latitude             ; [*]
      lon    = f->longitude          ; [*]

       ism = *ind
<http://www.ncl.ucar.edu/Document/Functions/Built-in/ind.shtml>*(*.not*
*.ismissing* <http://.ismissing>(sm) .and. lat.ge.latS   .and. lat.le.latN \
                                                       .and. lon.ge.lonL
.and. lon.le.lonR)
       npts = *dimsizes*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml>(ism)

       sm_avg = *avg*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/avg.shtml>(sm(ism))
==================================================
Side points:

Alessandra's suggestions would be appropriate if the original data were on
a rectilinear grid and then had been placed onto 1D arrays. Then, if you
knew the appropriate nlat and mlon sizes you could have used

      xGrid = *conform_dims
<http://www.ncl.ucar.edu/Document/Functions/Built-in/conform_dims.shtml>*(
(/nlat,mlon/), x1d)   ; (nlat,mlon); similar to *onedtond*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/onedtond.shtml>

===
The documentation for *wgt_areaave
<http://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_areaave.shtml>*
should be clarified. This function expects a *rectilinear* grid.

======
On Sun, Aug 12, 2018 at 4:13 PM, alesall <alesall at iri.columbia.edu> wrote:

>
> Hi Ehsan,
>
> can you reorganize your data so that it is 2-dimensional, in latitude and
> longitude?
> If your “var” measures something which varies in latitude and longitude,
> you need to figure out how the data in it is ordered/organized.
> Is the fastest dimension longitude or latitude?
> You can use functions like “onedtond” to break down a vector of length
> nlon x nlat into a matrix of dimensions nlon, nlat.
> And then assign names/values of latitude and longitude to the dimensions
> accordingly.
>
> warm regards
>
>
>
>
> --
> Alessandra Giannini
> IRI for Climate and Society - The Earth Institute at Columbia University
> P.O. Box 1000, Palisades NY 10964-8000
> phone/fax: +1 845 680-4473/4864 - email: alesall at iri.columbia.edu
>
> On Aug 12, 2018, at 3:16 PM, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com>
> wrote:
>
> Hi,
> I'm sorry to forward my question again! Do you think it is possible doing
> this or I should leave it?
> I'll be thankful for any suggestion.
>
> Sincerely
> Ehsan
>
>
> ----- Forwarded Message -----
> *From:* Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com>
> *To:* Ncl-talk <ncl-talk at ucar.edu>
> *Sent:* Thursday, August 2, 2018, 8:00:22 PM GMT+4:30
> *Subject:* area average
>
> Hi,
> I've tried to compute area average using "wgt_areaave". However it seems
> my data are 1 dimensional. So the following error occurred, as it is
> expected:
>       fatal:wgt_areaave: the input array must have at least 2 dimensions
>
> Could I ask any help to have are average from 1 dimension data?!
>
> I attached my script and put input files (SPL2SMP_E.tar) in ftp. Other
> information are:
> $ ncl -V
>      6.5.0
> $ uname -a
>      Linux localhost.localdomain 3.10.0-514.2.2.el7.x86_64 #1 SMP Tue Dec
> 6 23:06:41 UTC 2016 x86_64         x86_64 x86_64 GNU/Linux
> $ gcc --version
>      gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
>      Copyright (C) 2015 Free Software Foundation, Inc.
>
> I'll be thankful for any help.
>
> Sincerely
> Ehsan
> <SPL2SMP_E_areaave.ncl>_______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> _______________________________________________
> 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/20180812/35ae2c07/attachment.html>


More information about the ncl-talk mailing list