The conflict between netCDF4 and ArcGIS has a long and illustrious history. Example here.
Your problem sounds different from the one I had a few years ago, though. So small chance it's a problem with your code. Beyond that, there are at least two alternative netCDF readers that do work with ArcGIS:There are others, and they all use very similar APIs. Unfortunately, none of them offer the cool bells-and-whistles that netCDF4 offers.
- ScientificPython - I've been submitting Windows installers for this project. Right now the latest one is compatible with AGD 10.0.
- scipy.io.netcdf - This will bomb on really, really big files. ScientificPython won't.
Hope that helps.
Hey, thank you for the response. I am running AGD 10.1, which uses python 2.7. It looks like the latest windows installer is for python 2.6. I believe I tried this one and was having compatibility issues with ArcGIS 10.1. Do you know any window installers for python 2.7? Thanks again.
Just a week ago Christoph Gohlke built a completely static NetCDF4 module specifically for use with ArcGIS 10.1, and in my testing it has worked flawlessly. Check out the link to netCDF4-1.0.5dev-ArcGIS-10.1.win32-py2.7.exe on Christoph's amazing Python libraries for Windows page: http://www.lfd.uci.edu/~gohlke/pythonlibs/#netcdf4
Thank you so much for the responses. I downloaded the python 2.7 version of ScientificPython, and for some reason I am not having success running the module within Arc. I keep getting an error of "IOError: netcdf: Invalid argument", but the same argument seems to be working outside of Arc. I also downloaded the mentioned netCDF4 module and I am getting the same error I was originally getting in the first post. My script runs perfect one time through, but then the next time through I am have problems. I first read in the netcdf file using:
dataset= Dataset('nameofmynetcdf.nc')
And then I try and read the latitudes using the command:
lt = dataset.variables['lat'][:]
This works perfectly the first time through, but then second time through I get an error for this line which states:
AttributeError: 'NoneType' object has no attribute 'iterable'
Does anyone know why this would be? I am reading this data via opendap if that makes any difference at all(?). I would really appreciate any help anyone has to offer. Thank you!
I also downloaded the mentioned netCDF4 module and I am getting the same error I was originally getting in the first post. I am reading this data via opendap if that makes any difference at all(?). I would really appreciate any help anyone has to offer. Thank you!
from netCDF4 import Dataset data= 'http://cloud.insideidaho.org:8001/reacch/CMIP5/maca_huss_BNU-ESM_historical_1950_1959_WUSA.nc' MyData=Dataset(data) lt = MyData.variables['lat'][:] arcpy.AddMessage(lt)