[ncl-talk] 3 dimensions to 2 dimensions

Rick Brownrigg brownrig at ucar.edu
Tue Apr 30 06:46:03 MDT 2019


HI,

It looks like there may be several problems going here:

i) I speculate you mean something more like this:
  time =f->time
  lat =f->latitude
  lon =f->longitude
  ntim = dimsizes(time)
  nlat = dimsizes(lat)
  nlon = dimsizes(lon)

ii) I'm not sure the intent here:

   Rain(nl,ml) = TRMM(nt,nl,ml)

Each time through the inner loop, it will (re)assign the one by one "nt"
values of TRMM to the same element of Rain(nl, ml), exiting the loop with
it set to the "nt-1"th value. Its equivalent to foregoing the entire inner
loop and just saying Rain(nl,ml) = TRMM(nt-1,nl,ml)

Hope that helps,
Rick



On Tue, Apr 30, 2019 at 4:00 AM Md. Jalal Uddin <dmjalal90 at gmail.com> wrote:

> Hi all,
>
> I have tried to take all rainfall data  for each latitude and longitude
> point and made 2 dimensions from 3 dimensions. I am getting the following
> errors.
> fatal:_NclBuildArray: each element of a literal array must have the same
> dimension sizes, at least one item doesn't
>
> The main code:
>
> f = addfile("bob_vscs.nc","r")
>   ntim =f->time
>   nlat =f->latitude
>   nlon =f->longitude
>   TRMM = f->pcp(:,{0:30},{75:100})        ;TRMM(time 390, latitude 120,
> longitude 100)
>
>   Rain =new((/nlat,nlon/),"float")
>
>     do nl=0,nlat-1
>      do ml=0,nlon-1
> do nt=0,ntim-1
> Rain(nl,ml) = TRMM(nt,nl,ml)
> end do
> end do
>     end do
>
> Could you help me to solve the problem, please?
>
> Best Regards,
> Jalal
> --
> *Md. Jalal Uddin*
> MSc in Applied Meteorology (English Language)
> Nanjing University of Information, Science and Technology, China
> B.Sc. in Disaster Management (Hons.)
> Patuakhali Science and Technology University, Bangladesh.
> Cell: +8613260859092, +8801792052662
> Web: www.dmjalal90.weebly.com
> Facebook: jalal.hossen.39
> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
> Twitter: dmjalal90
> Skype: dmjalal90
> _______________________________________________
> 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/20190430/08e47773/attachment.html>


More information about the ncl-talk mailing list