[ncl-talk] Why the res of DstGridMask can not make the destination grid have missing values as defined?

Mary Haley haley at ucar.edu
Mon Dec 19 15:06:00 MST 2016


Lin,

I'm confused by the comment on this line:

    Opt at SrcGridMask      = where(.not.ismissing(thetao(0,:,:)),1,0)      ;
thetao is the source grids, with data zero in land, no missing

When you say "data zero in land, no missing", do you mean that the "thetao"
variable is equal to 0 whenever it is over land, and that it contains no
missing values?  If so, then using "ismissing" on a variable that doesn't
contain missing values is never going to return True.

Instead, you want something like this:

    Opt at SrcGridMask      = where(thetao.ne.0,1,0)

This creates a mask array that is equal to 1 at locations where thetao is
NOT equal to 0, and equal to 0 at locations where thetao is equal to 0.

Just as an example, this line should produce the exact same mask array:

    Opt at SrcGridMask      = where(thetao.eq.0,0,1)

--Mary




On Mon, Dec 19, 2016 at 11:53 AM, 林祥 <xianglin72 at icloud.com> wrote:

> Hi, all
>
>        I have many CMIP5 sea ice concentration data and want to regrid
> them into the same grid coordinate as HadISST.
>
>  Since the land area own missing_value (_FillValue) in HadiSST, I also
> want the regridded data show missing values in land .
>
> I use the following  scripts:
>
>    fi   = addfile("HadISST_ice.nc","r")
>   hsic = fi->sic
>   hlon = fi->longitude
>   hlat = fi->latitude({-90.:-50.})
>    …….
>
>     Opt at SrcGridMask      = where(.not.ismissing(thetao(0,:,:)),1,0)
>  ; thetao is the source grids, with data zero in land, no missing
>     Opt at DstGridMask      = where(.not.ismissing(hsic(0,:,:)),1,0)
> ; hsic is the HadISST  SIC data, with missing values in land
>
>     Opt at DstGridLat       = hlat
>   Opt at DstGridLon       = hlon
> ……..
>
>      thetao_regrid = ESMF_regrid(thetao,Opt)
>
> However, I found the regridded data “thetao_regrid" show zero values, not
> missing values in land.
>
>
>        How to make the regridded data have missing values for the same
> grids as HadISST?
>
>
> Thank
>
>
> Lin
>
>
>
>
> _______________________________________________
> 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/20161219/ae3e3927/attachment.html 


More information about the ncl-talk mailing list