Anna Anna - 1 month ago 12
Python Question

ERROR 000732 in Python calling for NetCDF file

When executing the following code I keep getting an error and I was unable to fix it. Any ideas what could be wrong? I tried to change the file name to a simpler one but it didn't help. NetCDF data comes from TRMM.

import arcpy
import os
dir_name = 'D:\Data'


# Set local variables
inNetCDFFile = "D:\Data\3B43.20090201.7A.HDF.nc"
variable = "precipitation"
XDimension = "nlon"
YDimension = "nlat"
outRasterLayer = "D:\Data\test"
bandDimmension = ""
dimensionValues = ""
valueSelectionMethod = ""

# Execute MakeNetCDFRasterLayer
arcpy.MakeNetCDFRasterLayer_md(inNetCDFFile, variable, XDimension, YDimension,
outRasterLayer, bandDimmension, dimensionValues,
valueSelectionMethod)


Error:

Traceback (most recent call last):
File "D:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
exec codeObject in __main__.__dict__
File "D:\Google Drive\Gates Project\Data\Climate\TRMM\Python\TRMMNetCDFtoRaster.py", line 19, in <module>
valueSelectionMethod)
File "D:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\md.py", line 171, in MakeNetCDFRasterLayer
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input netCDF File: Dataset D:\DataB43.20090201.7A.HDF.nc does not exist or is not supported
Failed to execute (MakeNetCDFRasterLayer).

Answer

Clearly you are trynig to load a wrong file path:

ERROR 000732: Input netCDF File: Dataset D:\DataB43.20090201.7A.HDF.nc does not exist or is not supported

If you are on Windows use:

inNetCDFFile = "D:\\Data\\3B43.20090201.7A.HDF.nc"

or

inNetCDFFile = r"D:\Data\3B43.20090201.7A.HDF.nc"

Charlie