Select to view content in your preferred language

Problem with reading NetCDF file

1634
2
Jump to solution
04-26-2013 06:40 AM
AlexanderKeyel
Deactivated User
I am working with the Make NetCDF Feature Layer (Multidimension) tool with Python.  I can get it to work properly outside of Python (but have a lot of data to process, so doing it manually is not really an option).

I am having a problem with entering the {row_dimension}.  I need to enter two dimensions, "lat" and "lon", but I can't get it to accept a list.  It will accept either variable alone and not give an error message, but if I try to enter a list, I get the following error message:
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000237: One or more dimensions are invalid
ERROR 000237: One or more dimensions are invalid
Failed to execute (MakeNetCDFFeatureLayer).

The help file suggests that a list would be the input?  Is there something obvious that I am missing, or is this a bug?
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Make_NetCDF_Feature_Layer/004300000005...

I have also tried using the raster tool, but receive an error message that my data have irregular spacing and that I need to use the make feature layer tool and interpolate.

A simplified version of my code is below:
#Import arcpy import arcpy  #Set up paths bpath = "C:\\docs\\Work\\historical_climate\\ESRL\\" dpath = bpath + "ncfiles\\" vpath = bpath + "vector\\"  #Set up file names ncfile = dpath + "air.sfc.1871.nc" nclyr = "nclyr" ncfilout = vpath + "test.shp"  #Set up inputs for NetCDF to Feature layer variable = ["air","time"] x_variable = "lon" y_variable = "lat"  #THIS IS THE PROBLEM. x_variable alone works (but does not give the needed output). [x_variable] does not. This apparently can't take a list. row_dimension = [x_variable,y_variable]    arcpy.MakeNetCDFFeatureLayer_md (ncfile, variable, x_variable, y_variable, nclyr, row_dimension) arcpy.CopyFeatures_management (nclyr, ncfilout)
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
markdenil
Frequent Contributor
Checking my old NetCDF import scripts, I see they use arcgisscripting(9.3) and not arcpy
so the syntax is "lon;lat" instead of a list...

If it works using the MakeNetCDFFeatureLayer tool, you could set it up in Model builder and
export the model as a python script. That is one way of nailing down syntax issues.

You really only need the one MakeNetCDFFeatureLayer step in the model,
'cuz you just want to see the syntax for the one tool.

View solution in original post

0 Kudos
2 Replies
markdenil
Frequent Contributor
Checking my old NetCDF import scripts, I see they use arcgisscripting(9.3) and not arcpy
so the syntax is "lon;lat" instead of a list...

If it works using the MakeNetCDFFeatureLayer tool, you could set it up in Model builder and
export the model as a python script. That is one way of nailing down syntax issues.

You really only need the one MakeNetCDFFeatureLayer step in the model,
'cuz you just want to see the syntax for the one tool.
0 Kudos
AlexanderKeyel
Deactivated User
The semi-colon worked - many thanks!

It's been so long since I've used model builder that I didn't think to use it to try to check the syntax, and in part, I thought it was a bug since the help file showed the inputs as a list.
0 Kudos