I received some data files (NetCDF) from a colleague and I am trying to concatenate these files into a single file, so that I am able to run it with some of my previous scripts. The issue is that the NetCDF files I received have dimension "height" with fill values of 1e20. This is causing an error when I try almost any xarray operations on the files, because there are duplicate values in the dimension coordinates.
Here is the info on one of the files (you can see the repeating values in the final values of the "height" coordinates):
<xarray.Dataset> Dimensions: (height: 1061)
Coordinates: * height (height) float64 0.0 10.0 20.0 30.0 ... 1e+20 1e+20 1e+20 1e+20
Data variables:
pres (height) float32 ...
tdry (height) float32 ...
rh (height) float32 ...
u_wind (height) float32 ...
v_wind (height) float32 ...
mr (height) float32 ...
theta (height) float32 ...
theta_e (height) float32 ...
theta_v (height) float32 ...
lat (height) float32 ...
lon (height) float32 ...
alt (height) float32 ...
wdir (height) float32 ...
I thought may be reindexing to a new index with no fill values might help, but I am also unable to do that as the error pops up again that:
ValueError: cannot reindex or align along dimension 'height' because the index has duplicate values
If someone could help me out here, it would be a great favour! I have been struggling with this for a while, but maybe the solution is quite simple and my beginner's status is not really being helpful here. :/