Skip to Content.

mget-help - RE: [mget-help] Help with MGET HDF to Raster "Output Raster Name Options"

Please Wait...

Subject: Marine Geospatial Ecology Tools (MGET) help

Text archives


From: "Jason Roberts" <>
To: "'Matt Love'" <>
Cc: <>
Subject: RE: [mget-help] Help with MGET HDF to Raster "Output Raster Name Options"
Date: Fri, 6 Jan 2012 16:01:47 -0500

Hi Matt,

 

That parameter is often the crux of that tool. Try the following _expression_. It will probably work all of the OSU 8-day or monthly ocean productivity products in HDF format.

 

os.path.join(outputWorkspace, os.path.dirname(inputFile[len(directoryToSearch)+1:]), ''.join(os.path.basename(inputFile).split(u'.')[0:2]))

 

I won’t go into an exhaustive description here, but basically, I switched the following from the original _expression_

 

os.path.basename(inputFile).split(u'.')[0][:13]

 

to this:

 

''.join(os.path.basename(inputFile).split(u'.')[0:2])

 

A rough English translation of the second _expression_ is: join together the first two character strings obtained by splitting up the HDF file name into separate strings at the . characters. In other words, turn vgpm.2002182.hdf.gz into vgpm2002182

 

Sorry for the complexity here. We hope to eventually invent a default _expression_ that works for all versions of ArcGIS and all input files, but that’s been on the back burner for a while. The existing _expression_ does not work very well for files such as these that use . as part of the file name rather than just as a separator between the file name and the file extension.

 

Best,

 

Jason

 

 

From: Matt Love [mailto:]
Sent: Friday, January 06, 2012 3:28 PM
To:
Subject: [mget-help] Help with MGET HDF to Raster "Output Raster Name Options"

 

Hi

I’m converting HDF files to ESRI Grids using the Find HDFs and Convert SDS To ArcGIS Rasters tool. Could anyone provide guidance on what parameters of the _expression_ below need to be changed to enable unique names for each raster output? I’m getting the error below that the same name is being used for multiple outputs and I have not figured out how to change the _expression_ to prevent this

 

Many thanks

Matt

 

Default _expression_

os.path.join(outputWorkspace, os.path.dirname(inputFile[len(directoryToSearch)+1:]), os.path.basename(inputFile).split(u'.')[0][:13])

 

ValueError: The same output C:\Files\GIS\Data\Biology_and_Ecology\Primary_Productivity\Rasters is specified for two different inputs: C:\Files\GIS\Data\Biology_and_Ecology\Primary_Productivity\HDF_format\vgpm.2002182.hdf.gz and C:\Files\GIS\Data\Biology_and_Ecology\Primary_Productivity\HDF_format\vgpm.2002213.hdf.gz (elements #0 and #0 of inputFileList, where 0 is the first element). This is not allowed because when the second input was processed, it would overwrite the output of the first one. This problem usually occurs when the outputs are paths or names calculated by a Python _expression_ that produces the same result for two different inputs. If you received this error message after invoking a tool or function that calculates outputs using Python expressions, you must adjust the expressions. The default expressions are usually sufficient for a variety of situations but they may not be suited to your inputs.

<type 'exceptions.ValueError'>: The same output C:\Files\GIS\Data\Biology_and_Ecology\Primary_Productivity\Rasters is specified for two different inputs: C:\Files\GIS\Data\Biology_and_Ecology\Primary_Productivity\HDF_format\vgpm.2002182.hdf.gz and C:\Files\GIS\Data\Biology_and_Ecology\Primary_Productivity\HDF_format\vgpm.2002213.hdf.gz (elements #0 and #0 of inputFileList, where 0 is the first element). This is not allowed because when the second input was processed, it would overwrite the output of the first one. This problem usually occurs when the outputs are paths or names calculated by a Python _expression_ that produces the same result for two different inputs. If you received this error message after invoking a tool or function that calculates outputs using

 

Matt Love

Conservation Biologist-GIS Specialist

6160 Perkins Street, Suite 120

Baton Rouge, LA 70808

O: 225-590-5043

Web | Facebook | Twitter

 

Archives powered by MHonArc.
Top of Page