# [ncl-talk] Fw: usage of landsea.nc for separation of point data

Dennis Shea shea at ucar.edu
Mon Jul 23 08:52:14 MDT 2018

```http://www.ncl.ucar.edu/Document/Functions/Shea_util/landsea_mask.shtml

As noted in the function description, the *landsea_mask* function returns a
*grid*.

"*Returns a grid *that contains a land/sea mask given any latitude and
longitude array."

---

The 'lat' and 'lon' define the coordinates of an array with some
quasi-regular' structure:

x(lat,lon)   where lat[*],lon[&] are the coordinates of a rectilinear grid.

X(LAT,LON)   where LAT and LON are two-dimensional
LAT ==> XLAT(nlat,mlon);  LON ==> XLON(nlat,mlon)

My understanding is that you are inputting station or random locations
rather than a grid-type structure.
You can use landsea_mask in a loop

print("---")

Z1          =
NUM         =   dimsizes(Z1)
print(NUM)
print("---")

LAT         =   new(NUM,float)
LON         =   new(NUM,float)
LSM         =   new(NUM,byte)

do II       =   0, NUM-1
SPLIT    =   str_split(Z1(II)," ")
LAT(II)  =   tofloat(SPLIT(15))
LON(II)  =   tofloat(SPLIT(16))
locations (II)
end do

print(LAT+"   "+LON+"   "+LSM)

On Sat, Jul 21, 2018 at 10:20 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:

> hi Dennis.
>
>
> I earlier sent a message that it has been sorted out. Pls excuse me.
> I have one small doubt.
> I have given one LAt/LON as input then the output is 0 or 1.
> But when I give full array of lat/lon as input, it gives me 2 dimensionsl
> array of 0 and 1.
> here is my code.
>
>
> ;                   print(Z1)
>     NUM        =    dimsizes(Z1)
>                     print(NUM)
>
>    LAT         =   new(NUM,float)
>    LON         =   new(NUM,float)
>
>    do II       =   0, NUM-1
>    SPLIT       =   str_split(Z1(II)," ")
>    LAT(II)     =   stringtofloat(SPLIT(15))
>    LON(II)     =   stringtofloat(SPLIT(16))
> ;                  print(LAT(II)+" "+LON(II))
>    end do
>
> ;  Open landsea file
>
> )
>                    printVarSummary(MASK)               ; 2 dim var
>                    print(LAT(0)+"------------ "+LON(0))
>
>
>  Individual points, Output is 0 or 1
>  Gave full array as input
>          ;  Required for Plotting purpose
>                   printVarSummary(lsm)               ; 2 dim var
> ;                 printVarSummary(LO)               ; 2 dim var
> ;                 print(lsm)
> %8.1f %4i")
>
> the output is
> Variable: NUM
> Type: integer
> Total Size: 4 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) 94
>
> Type: byte
> Total Size: 64800 bytes
>             64800 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat | 180] x [lon | 360]
> Coordinates:
>             lat: [-89.5..89.5]
>             lon: [0.5..359.5]
> Number Of Attributes: 1
> (0) 12.2952------------ 78.1018
>
> Variable: lsm
> Type: byte
> Total Size: 8836 bytes
>             8836 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat | 94] x [lon | 94]
> Coordinates:
>             lat: [12.29523..17.34258]
>             lon: [78.10181..72.63507]
> Number Of Attributes: 1
>   _FillValue : -127
>
> My doubt is that in the output file, 8896 values are coming. (94*94).
>
> Geeta.
>
>
> On Friday, 20 July 2018 11:45 PM, Dennis Shea <shea at ucar.edu> wrote:
>
>
>    http://www.ncl.ucar.edu/ Document/Functions/Shea_util/
>
> As noted in the documentation, the land-sea mask is a 1x1 grid.
>
> ---------------
>
> -----------------
> http://www.ncl.ucar.edu/ Applications/climo.shtml
> <http://www.ncl.ucar.edu/Applications/climo.shtml>
> climo_6.ncl
> ------------------
> http://www.ncl.ucar.edu/ Applications/unique.shtml
> <http://www.ncl.ucar.edu/Applications/unique.shtml>
> unique_14.ncl
> ------------------
> http://www.ncl.ucar.edu/ Applications/mjoclivar.shtml
> <http://www.ncl.ucar.edu/Applications/mjoclivar.shtml>
> mjoclivar_1.ncl
>
> On Fri, Jul 20, 2018 at 11:12 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:
>
> hi all.
> i have some lat/lon of some points that I have plotted on the map. It is a
> simple txt file which contains this information (lat/lon) and I have
> separarate these points into land and sea.
>
> I wanted to know how to use the file landsea.nc  that separates the point
> data over land and over ocean. sample txt file is shown below.
> 20080508.59705.7.HDF     13.367300 76.986855
> 20080530.60046.7.HDF     17.905054 76.779205
> 20090505.65352.7.HDF     5.941240   79.00
> 20090517.65536.7.HDF     18.066799 76.019241
>
> I have attached a sample figure for your reference.
>
>
> Geeta.
>
> ______________________________ _________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/ mailman/listinfo/ncl-talk
> <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/20180723/9a64f769/attachment.html>
```