I am trying to convert NetCDF files, available from this link, to raster or geotiff files using Python 3. After reading the a NetCDF file using the package netcdf4, it appears to have groups: CO2, CO2_uncertainty, and O2.
import netCDF4 as nc xds = nc.Dataset('GCP_Global_1959.nc') xds
I then tried to open the file with xarray and had the following output where I can see the coordinates and time slices. Although, the coordinates seem to be out of bounds.
import xarray as xr xds = xr.open_dataset('GCP_Global_1959.nc')
Finally, I tried to add a group to the open_dataset call but coordinates are missing.
xds = xr.open_dataset('GCP_Global_1959.nc', group='CO2')
I've tried the solution from Using GDAL, NetCDF4 to GeoTIFF wrongly rotates the output GeoTIFF file 90 degrees but it doesn't seem to work.
How can I convert this NetCDF file to a raster?