AnsweredAssumed Answered

gp.MakeNetCDFRasterLayer reads wrong optional parameter?

Question asked by geonetadmin on May 11, 2010
Original User: psjorgensen

Hi, I'm quite new to geoprocessing in Python. I'm trying to use the gp.MakeNetCDFRasterLayer tool on the CRU TS 3.0 climate time series.

I'm quite sure I'm specifying my variables correct. I'm not using a bandwidth parameter, but I'm trying to make a raster from a single time step by specifying the Dimension values as = "time 500". When running the script I conclude that the dimension values setting is read as the bandwidth parameter because I get this output:

Executing: MakeNetCDFRasterLayer ( tmp lon lat TMP_raster45 "time 500" # BY_VALUE

These are the error messages I get:
"Failed to execute. Parameters are not valid."
"ERROR 000237: One or more dimensions are invalid"
"Failed to execute (MakeNetCDFRasterLayer)."

The bandwidth parameter is before the dimension values parameter, but both are optional. The "#" after "time 500" must mean that the python doesn't read a dimension values parameter but takes "time 500" as the bandwith parameter, right? How can I get around this? Can I specify a value for the bandwidth parameter that will make it be excluded?

When I try running the script by explicitly naming the optonal parameters like this:

   # Set local variables
    InNetCDFFile = "F:/recovered/Dokumenter/KU/BIO/MS/TS3.0/TMP/"
    InVariable = "tmp"
    InXDimension = "lon"
    InYDimension = "lat"
    OutRasterLayer = os.path.join(outputfolder, "TMP_raster50")
    #Bandwidth = ""#""
    DimensionVal = "time 500"
    ValSelectionMethod = "BY_INDEX"
    # Process: MakeNetCDFRasterLayer  
    gp.MakeNetCDFRasterLayer(InNetCDFFile, InVariable, InXDimension, InYDimension, OutRasterLayer, dimension_values = DimensionVal, value_selection_method = ValSelectionMethod) # ValSelectionMethod)

I don't get any error messages, but exit code 0 and no file is created.

Any help is highly valued. Best,

Peter Jørgensen