-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
gridded_timeseriesIssues relating to the gridded time series productIssues relating to the gridded time series productquestionFurther information is requestedFurther information is requested
Milestone
Description
Have a query about the interpolation done in grid_variable function in gridded_timeseries.py
Had a situation where in some timesteps the profile had nan data, which when interpolated seems to produce more nans that I expected. Consider the toy problem
print("np.interp test")
depth_bins = np.array([10, 20, 30, 40, 50])
depths = np.array([12, 27, 35, 46])
values = np.array([1, 2, np.nan, 5])
print(depth_bins)
interp_values = np.interp(depth_bins, depths, values, left=np.nan, right=np.nan)
print(interp_values)
# interpolate non-nan
nmask = np.logical_or(np.isnan(depths), np.isnan(values))
interp_values = np.interp(depth_bins, depths[~nmask], values[~nmask], left=np.nan, right=np.nan)
print(interp_values)which produces
np.interp test
[10 20 30 40 50]
[ nan 1.53333333 nan nan nan]
[ nan 1.53333333 2.47368421 4.05263158 nan]
What is the reasoning to want depth_bins 30 and 40 to be set to nan?
Metadata
Metadata
Assignees
Labels
gridded_timeseriesIssues relating to the gridded time series productIssues relating to the gridded time series productquestionFurther information is requestedFurther information is requested