[ncl-talk] masking a 2dfield
Francesco Trotta
francesco.trotta4 at unibo.it
Fri Jul 28 13:34:48 MDT 2017
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170728/45cde710/attachment.html
More information about the ncl-talk
mailing list