Can someone please help me undertand (and potentially solve) a problem with nearneighbor?
Here is my code snippet:
hi_grd = pygmt.nearneighbor(x=np.ravel(lon_mask.values),
y=np.ravel(lat_mask.values),
z=np.ravel(hi_mask.values),
region=ext_plt,
spacing="15m",
search_radius="20m")
Before I put [[hi_mask]] through [[nearneighbor]] method [[hi_mask]] has min/max values of:
0.21114222705364227
2.829690456390381
However after [[nearneighbor]] [[grdinfo]] reports:
: Title:
: Command:
: Remark:
: Gridline node registration used [Geographic grid]
: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
: x_min: -19.0000000
: x_max: 18.0000000
: x_inc: 0.2500000
: name: x
: n_columns: 149
: y_min: -76.0000000
: y_max: -66.0000000
: y_inc: 0.2500000
: name: y
: n_rows: 41
: zmin: 0.976684
: zmax: 0.976684
: name: z
: scale_factor: 1 add_offset: 0
: format: classic
: Default CPT:
where:
hi_bar = reg_cice.hi.mean(dim='time',skipna=True).compute()
hi_mask = hi_bar.where((fic > 0) & (fic < 1), np.nan)
and [[fic]] is a gridded field that ranges from 0 to 1.
The 0.97 value that [[grdinfo]] is reporting is odd because it appears to be picking up the values of [[fic]], which for some reason xarray is unaware or is able to deal reporting of masked values better/worse than [[grdinfo]] or possibly [[nearneighbor]].
Any help is kindly appreciated.