Batch conversion of NetCDF to raster - python script

2408
1
Jump to solution
08-09-2012 08:54 PM
RobKay
by
New Contributor II
Hi everyone
I've got a lot of netCDF files that I have to convert to rasters.  Each netCDF will be divided into 12 rasters based on the "month" dimension (jan = 1 .... dec = 12).  I've written a script to loop through all the netCDF files in my workspace and convert them to the rasters, each with an appropriate name.  I need some help fixing the script, it falls over before converting anything and gives me the following error:

Processing: E:\SOLAR_DATA\netcdf\monthly_means_daily_ghe\ghe_stats_1990-1990.nc
Traceback (most recent call last):
  File "N:/gdmp/Solar/BOMNetCDFConversion/rob_working.py", line 90, in <module>
    arcpy.MakeNetCDFRasterLayer_md(nc, variable, xdimension, ydimension, nowFileNew, "", ncDimValue, valueSelectionMethod)
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\md.py", line 165, in MakeNetCDFRasterLayer
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000238: One or more dimension values are invalid
Failed to execute (MakeNetCDFRasterLayer).

My script is attached.

Any help would be greatly appreciated
Cheers
Rob
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobKay
by
New Contributor II
Hi everyone
I figured out what was going wrong and thought I'd post it just in case someone was running into the same issue.
The MakeNetCDFRasterLayer_md command was not working because the required input for the dimension_values parameter is a value table, I was trying to input a different data type.

MakeNetCDFRasterLayer_md (in_netcdf_file, variable, x_dimension, y_dimension, out_raster_layer, {band_dimension}, {dimension_values}, {value_selection_method})

Once I created the value table and loaded it with the appropriate dimensions and values, 2 column table as is shown when running the tool in desktop, everything went smoothly.

Cheers
Rob

View solution in original post

0 Kudos
1 Reply
RobKay
by
New Contributor II
Hi everyone
I figured out what was going wrong and thought I'd post it just in case someone was running into the same issue.
The MakeNetCDFRasterLayer_md command was not working because the required input for the dimension_values parameter is a value table, I was trying to input a different data type.

MakeNetCDFRasterLayer_md (in_netcdf_file, variable, x_dimension, y_dimension, out_raster_layer, {band_dimension}, {dimension_values}, {value_selection_method})

Once I created the value table and loaded it with the appropriate dimensions and values, 2 column table as is shown when running the tool in desktop, everything went smoothly.

Cheers
Rob
0 Kudos