# [ncl-talk] Error in regridding SMAP Freeze Thaw binary data

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Feb 1 18:33:05 MST 2022

```Jetal, you are using linint2 regridding.  This and most other regridders
will naturally compute fractional averages from the surrounding ones and
zeros.  I can think of several strategies to reduce down to your desired
ones and zeros.

1.  This is the simplest and quickest.  Trust that the numerical averaging
is an accurate representation of the desired outcome.  Apply a simple
numeric threshold to convert to ones and zeros.  Do this right after
linint2 and the print statements.  The first line is necessary to handle
the missing values that you showed, and you might want to adjust this for
the desired missing value outcome.

flh   = where ( ismissing (flh), 0, flh )
flh2 = where ( (flh .ge. 0.5), 1, 0 )

2.  Write your own regridding algorithm that decides ones and zeros based
on nearby input grid points, and your choice of decision criteria.  For
example, weighted or unweighted averages or counts, of input grid points
within a given radius of each output grid point.

This could also be as simple as "copy the nearest input grid point value to
the output grid point".

3.  Search NCL docs for a regridding method specifically designed for ones
and zeros.  I doubt that there is one, but maybe.  ESMF could possibly have
something like this, for the same reason as yours.

4.  Look at NCO operators and CDO for the same thing.

On Tue, Feb 1, 2022 at 5:52 PM JETAL SUTARIYA via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hi NCL Community,
>
> I am trying to regrid the SMAP L3 Freeze thaw 36 km data to NLDAS grid
> (1/8th degree). I have already converted data from EASE grid to regular
> lat/lon grids separately.
> But SMAP freeze thaw contains binary data i.e. 0 if grid is non-frozen and
> 1 if grid is frozen so when I regrid the file; I get different values
> between 0 and 1,
> for eg., 0.05755893, 0.3908837, 0.7242084,
>     0.8300187, 0.496694, 0.1633693, 0, 0, 0, 0, 0, 0, _, _, _, _, _, 0, 0,
> 0,
>     0.007007165, 0.02686451, 0.04672185, 0.045869, 0.02601166, 0.006154316,
>     0.01370303, 0.03356037, 0.05341771, 0.03917314, 0.0193158, 0, 0, 0, 0,
> 0,
>     0, 0.007237409, 0.02709475, 0.04695209, 0.04563876, 0.02578142.
> This is incorrect since the data should be binary in the regridded freeze
> thaw variable.
> Does anybody have an idea how to reflect that while regridding?
>
> I have attached a few files here: 1) ncl script that I used to complete
> this task, 2) Screenshots of the PrintVarSummary error of input and gridded
> variable 3) Screenshot of output variable which is not binary.
>
> Any suggestions are very helpful.
> Thanks,
> Jetal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220201/05c3bfd2/attachment.html>
```