[ncl-talk] masking a 2dfield

Mary Haley haley at ucar.edu
Mon Jul 31 13:26:22 MDT 2017


Check out the gc_inout function:

http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_inout.shtml

--Mary




On Fri, Jul 28, 2017 at 1:34 PM, Francesco Trotta <
francesco.trotta4 at unibo.it> wrote:

> Dear ncl-team
>
>     I've a file containg the bathymetry (nx * ny) and I would like to mask
> a subdomain containg inside a closed polyline.
>
>
>     For a square polyline a try the solution below, but I would like to
> extend this procedure to a generic closed polyline.
>
>     Is there in ncl a function which allow me to mask a
> particular region of a 2d-field?
>
>
>
>
>
> if(lonWest_isletoMask .ge. lon1dt_surf(0) .or. lonEast_isletoMask .le.
> lon1dt_surf(nx(inest)-1)) then
>       if(latSout_isletoMask .ge. lat1dt_surf(0) .or. latNort_isletoMask
> .le. lat1dt_surf(ny(inest)-1)) then
>          idxlon_isletoMask = ind((lon1dt_surf(0:nx-1) .ge.
> lonWest_isletoMask) .and. (lon1dt_surf(0:nx-1) .le. lonEast_isletoMask))
>          idxlat_isletoMask = ind((lat1dt_surf(0:ny-1) .ge.
> latSout_isletoMask) .and. (lat1dt_surf(0:ny-1) .le. latNort_isletoMask))
>          do j=0,dimsizes(idxlat_isletoMask)-1
>                   do i=0,dimsizes(idxlon_isletoMask)-1
>                      if((.not.ismissing(idxlon_isletoMask(i))) .and.
> (.not.ismissing(idxlat_isletoMask(j))))
>                         bathy(idxlat_isletoMask(j),idxlon_isletoMask(i))
> = 0.
>                      end if
>               end do
>           ;print(" ")
>            end do
>          delete(idxlon_isletoMask)
>          delete(idxlat_isletoMask)
>       end if
>    end if
>
>
>
>
> thanks
>
> Francesco
>
> _______________________________________________
> 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/20170731/0667cf61/attachment.html 


More information about the ncl-talk mailing list