ldeo-glaciology/xapres

Measurement gaps result in non-uniform datetime grid and result in interpolation issue with plotting

Opened this issue · 2 comments

Need to think of a good way of indicating gaps in data with the xarray plotting. Could either just plot a mask over it and avoid the skipped dates. The issue is that typical data sets would have a regularly gridded timeseries and NaNs or zeros for missing values. Our dataset on the other hand pulls the date values from each measurement, so our missing values also have missing dates, resulting in this lack of a uniform grid. This makes it a bit trickier to define the gaps and properly illustrate them. Below is an example of what happens:
image
Here, the black dots indicate the timestamps of all the measurements made in the winter season. We see some pretty substantial data gaps, but it's not immediately obvious when plotting the entire profiles which sections are a result of these gaps.

I think the best approach is to identify the gaps by highlighting the irregular spacing in the datetime grid and use that to create a mask. Then we interpolate the data onto a regular grid, and then set the values in the mask to NaN.

Is it doing nearest neighbor interpolation? That is what it looks like - with breaks between regions of uniform data sitting halfway between the start and end of data gaps.