I'm trying to merge multiple NETCDF files into one. They all have the files in one directory and have the same starting name so I used this script:
import xarray
ds = xarray.open_mfdataset(r'D:\copernicus-tmp-data\2019\CMEMS*.nc',combine = 'by_coords', concat_dim="time")
ds.to_netcdf(r'D:\copernicus-tmp-data\2019\CMEMS_2019_merged_currents.nc')
The problem is that it's throwing an error and I couldn't figure out how to fix it:
ValueError: cannot reindex or align along dimension 'lat' because the index has duplicate values
Can you please help me?
Thanks in advance