0

I am trying to read NetCDF4 files from data developed by Toshicika Iizumi (https://doi.pangaea.de/10.1594/PANGAEA.909132) on global crop yields. I would like to turn the data into a form that is readable by ArcGIS Pro since ArcGIS doesn't recognize the NetCDF4 format.

I am reading the file with xarray like this...

import rioxarray
import xarray
fn = ".../yield_2012.nc4"
xds = xarray.open_dataset(fn)
xds

The output looks like this

There doesn't seem to be any information on the projection.

How can I turn this into a raster or GeoTIFF for use in ArcGIS Pro?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Atreya Dey
  • 39
  • 4
  • Did you try the 'Make netCDF Raster Layer' tool in the geoprocessing section? This way ArcGIS Pro can convert and thus read the file. see: https://pro.arcgis.com/en/pro-app/latest/tool-reference/multidimension/make-netcdf-raster-layer.htm – user90323 Apr 26 '21 at 17:03
  • I tried import arcpy fn = "yield_2016.nc4" arcpy.MakeNetCDFRasterLayer_md(fn, "var", "lon","lat","yield") but it doesn't seem like that worked. I also tried the geoprocessing tool and I can't see the nc4 file format in the directory. – Atreya Dey Apr 26 '21 at 17:09
  • The output should be in the default geodatabase if you run your command. Did you check there? – user90323 Apr 26 '21 at 17:25
  • If you wish to also ask about QGIS then please do that in a separate question. – PolyGeo Apr 26 '21 at 21:32
  • 1
  • You can convert a netcdf to a geotiff with gdal. In gdal to convert nc to tiff: gdal_translate -of GTiff Mynetcdf.nc MyTifOutput.tiff

    and if you know which projection it should be in, you can add the projection like so gdal_translate -a_srs EPSG:4326 MyUnprojectedTif.tiff MyProjectedOutput.tiff -- eg to add EPSG4326 projection.

    These can be combined to one line.

    Gdal can be run in python, the syntax will be a little different, you'll have to check that.

    – Beardsley Apr 27 '21 at 00:51

0 Answers0