[ncl-talk] Dimension size mismatch

Md. Jalal Uddin dmjalal90 at gmail.com
Sat Aug 10 01:44:02 MDT 2019


do nr=0,nRadius-1
    do nc=0,nCenter-2
       poly_lat := clat(nc,nr,:)
       poly_lon := clon(nc,nr,:)

       min_lat  = min(poly_lat)
       max_lat  = max(poly_lat)
       min_lon  = min(poly_lon)
       max_lon  = max(poly_lon)

;---Extract the desired rectangle of data

       PRC  := tcavg98({min_lat:max_lat},{min_lon:max_lon})

;---Set points that are outside of the circle of data to missing

       lat2d := conform(PRC, PRC&latitude, 0)
       lon2d := conform(PRC, PRC&longitude, 1)

       latlon_circle := gc_inout(lat2d,lon2d, poly_lat,poly_lon)
       PRC    = where(latlon_circle,  PRC, PRC at _FillValue)
       ;printVarSummary(PRC)

    if (nc.eq.0) then

                f_lsm    = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/
landsea.nc","r")

                     lsmtc   =
tobyte(landsea_mask(f_lsm->LSMASK,PRC&latitude,PRC&longitude))
                     lsmtc at long_name  = "Land-Sea Mask: TRMM 3B42"
                     copy_VarCoords(PRC, lsmtc)

                tc_land_MASK = where(lsmtc.eq.1 .or. lsmtc.eq.2, PRC,
PRC at _FillValue)
; Land only
                     copy_VarMeta(PRC, lsmtc)
                     print("tc_landgrid = "+tc_land_MASK)

    else

            f_lsm    = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/landsea.nc","r")


                     lsmtc1   =
tobyte(landsea_mask(f_lsm->LSMASK,PRC&latitude,PRC&longitude))
                     lsmtc1 at long_name  = "Land-Sea Mask: TRMM 3B42"
                     copy_VarCoords(PRC, lsmtc1)

               * tc1_land_MASK = where(lsmtc1.eq.1 .or. lsmtc1.eq.2, PRC,
PRC at _FillValue) ; Land only*
                     copy_VarMeta(PRC, lsmtc1)
                     print("tc1_landgrid = "+tc1_land_MASK)
end if

    end do   ; nc
end do      ; nr

>From the above green line error has occurred. The full code in the
attachment.

On Sat, 10 Aug 2019 at 14:27, Rashed Mahmood <rashidcomsis at gmail.com> wrote:

> Which line the error message occurs? Generally the printVarSummary() can
> be very useful for understanding the dimsize issues.
>
> On Fri, Aug 9, 2019 at 7:18 PM Md. Jalal Uddin <dmjalal90 at gmail.com>
> wrote:
>
>> Thank you, sir, for your kind suggestion, but it did not work.
>>
>> On Fri, 9 Aug 2019 at 18:25, Rashed Mahmood <rashidcomsis at gmail.com>
>> wrote:
>>
>>> Hi Jalal,
>>> I think the error message is likely related to the lines:
>>>
>>>   poly_lat = clat(nc,nr,:)
>>>   poly_lon = clon(nc,nr,:)
>>>
>>> Changed those to:
>>>   poly_lat * :=* clat(nc,nr,:)
>>>   poly_lon* :=* clon(nc,nr,:)
>>>
>>> hope that helps.
>>>
>>> Rashed
>>>
>>>
>>> On Thu, Aug 8, 2019 at 6:39 PM Md. Jalal Uddin via ncl-talk <
>>> ncl-talk at ucar.edu> wrote:
>>>
>>>>  do nr=0,nRadius-1
>>>>     do nc=0,nCenter-1
>>>>        poly_lat = clat(nc,nr,:)
>>>>        poly_lon = clon(nc,nr,:)
>>>>
>>>>        min_lat  = min(poly_lat)
>>>>        max_lat  = max(poly_lat)
>>>>        min_lon  = min(poly_lon)
>>>>        max_lon  = max(poly_lon)
>>>>
>>>> ;---Extract the desired rectangle of data
>>>>
>>>>        PRC  := jancont({min_lat:max_lat},{min_lon:max_lon})
>>>>
>>>> ;---Set points that are outside of the circle of data to missing
>>>>
>>>>        lat2d := conform(PRC, PRC&latitude, 0)
>>>>        lon2d := conform(PRC, PRC&longitude, 1)
>>>>
>>>>        latlon_circle := gc_inout(lat2d,lon2d, poly_lat,poly_lon)
>>>>        PRC    = where(latlon_circle,  PRC, PRC at _FillValue)
>>>> end do
>>>> end do
>>>>
>>>>
>>>> Here, when center lat changed (nc), the dimension size of PRC also
>>>> changed that means PRC has different size. Similar to
>>>> http://www.ncl.ucar.edu/Applications/Scripts/polyg_29.ncl
>>>>
>>>> I tried to mask overland for PRC data but failed because of different
>>>> dimension sizes.
>>>>
>>>> How can I make PRC as the same size? Any suggestions would be
>>>> appreciated.
>>>>
>>>> Jalal
>>>> --
>>>> *Md. Jalal Uddin*
>>>> MSc in Applied Meteorology
>>>> 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
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>> --
>> *Md. Jalal Uddin*
>> MSc in Applied Meteorology
>> 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
>>
>

-- 
*Md. Jalal Uddin*
MSc in Applied Meteorology
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190810/2aa0a993/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AI_test.ncl
Type: application/octet-stream
Size: 5276 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190810/2aa0a993/attachment.obj>


More information about the ncl-talk mailing list