arcpy.MakeNetCDFRasterLayer_md tool help

759
1
11-20-2017 07:46 PM
amandarumsey
New Contributor

Hello,

My name is Amanda, and I have a quick question regarding the arcpy.MakeNetCDFRasterLayer_md tool. I figured this group of experts would be a great resource for answering my question  I am in the process of running the arcpy.MakeNetCDFRasterLayer_md tool for over 12000 netcdf files, and I am having issues with the tool. My script works and is able to convert netcdfs to tiffs through a combination of the arcpy.MakeNetCDFRasterLayer_md and arcpy.CopyRaster_management tools, but after about 2000 files the script errors with "ERROR 000271: Cannot open the input datasets". It is not a data set issue, as if you start the script again at the failing point, it works for the next 2000+ data files and errors again. I am wondering why this is happening. I have a suspicion that it is memory related or environment related, but I cannot seem to fix the issue. I have attached the script below (not including the loop information or specific directory information). Again, this is not a syntax issue as it works. It seems like a deeper issue with the tool. 

My questions include:

1.do i need to set any temp environments to stop the error from happening?

2.do i need to clear the memory? I attempted this but any guidance would help.

2. why doesn't the tool output the raster through arcpy.MakeNetCDFRasterLayer_md? why do you have to create a copy through CopyRaster_management in order to extract the data?

Any advise would be greatly appreciated!

Thanks,

Amanda


arcpy.CheckOutExtension("Spatial")
in_netCDF_file=os.path.join( directory where netcdf files are stored)
variable=netcdf file name+".tif"
x_dimension="lon"
y_dimension="lat"
out_raster_layer=os.path.join(output to same directory where netcdf files are stored plus file name)
band_dimension=""
dimension_values=""
value_selection_method="BY_VALUE"
k_tiff=arcpy.MakeNetCDFRasterLayer_md(in_netCDF_file, variable, x_dimension, y_dimension, out_raster_layer, band_dimension, dimension_values, value_selection_method)

in_raster=k_tiff

out_rasterdataset=os.path.join(output to new directory called tiffs)
config_keyword=""
background_value=""
onebit_to_eightbit="NONE"
colormap_to_RGB="NONE"
pixel_type=""
scale_pixel_value="NONE"
RGB_to_Colormap="NONE"
transform="NONE"
format="TIFF"
nodata_value="-2147483647"
arcpy.CopyRaster_management(in_raster, out_rasterdataset, config_keyword, background_value, nodata_value, onebit_to_eightbit, colormap_to_RGB, pixel_type, scale_pixel_value, RGB_to_Colormap, format, transform)
#checkin arcpy spatial toolset
arcpy.CheckInExtension("Spatial")

0 Kudos
1 Reply