POST
|
I tested this a bit further and found out a bit more. MapDocument.saveACopy seems to embed some attribute with the output filename in both the MapDocument object and the resulting mxd file. MapDocument.saveACopy fails when writing to this same filename. Alternating filenames works by alternating the embedded attribute in the MapDocument object. I apparently created my test.mxd by saving a blank mxd, at some point calling mxd.saveACopy("C:/tmp/test2.mxd"), and later renaming it to test.mxd. This explains why I only see problems with C:/tmp/test2.mxd and no other path, and only with this mxd. BTW, I'm using Arc 10.1 SP1 and python 2.7.2. ArcMap's Save, Save As, and Save A Copy do not seem to do this.
... View more
11-11-2013
08:54 AM
|
0
|
0
|
364
|
POST
|
I've been using saveACopy in python and have been encountering strange errors as I develop my mapping/geoprocessing scripts. To demonstrate the problem, I saved a blank mxd to C:/tmp/test.mxd. It appears to be important to run the examples in fresh python sessions each time. This code:
import arcpy
mxd = arcpy.mapping.MapDocument("C:/tmp/test.mxd")
mxd.saveACopy("C:/tmp/test3.mxd")
mxd.saveACopy("C:/tmp/test3.mxd")
mxd.saveACopy("C:/tmp/test2.mxd")
mxd.saveACopy("C:/tmp/test3.mxd")
is able to save test3.mxd the first and third times but not the second time, when if fails with error:
AttributeError: MapDocObject: Unable to save. Check to make sure you have write access to the specified file and that there is enough space on the storage device to hold your document.
Obviously, it's not a problem with overwriting the previous output, it's not a permissions issue, and it's not a storage space issue. Separately, this code (in a fresh python session) also fails with the same error:
import arcpy
mxd = arcpy.mapping.MapDocument("C:/tmp/test.mxd")
mxd.saveACopy("C:/tmp/test2.mxd")
However, the same saveACopy code (in fresh python sessions each time) succeeds with C:/tmp/test3.mxd (as we've already seen), C:/tmp/tmp/test2.mxd, W:/test2.mxd, and W:/tmp/test2.mxd.
... View more
11-08-2013
02:14 PM
|
0
|
2
|
2687
|
POST
|
I thought I was subscribed to this thread, but wasn't. The DEM is a bit under 3.5e8 pixels. Most of this is a single drainage basin, and near the outflow, the flow accumulation model would add small accumulations from small watersheds to the large accumulations from the mainstem. A standard 32-bit single precision float has approximately 7(.2) significant digits of precision, so when flow accumulation from the mainstem reaches somewhere around 1e6 or 1e7, flow accumulation will start to lose some accumulation and will misrepresent which pixels have greater accumulation than which other pixels. By way of conceptual example, in the land of single-precision floats, 12345678 + 1 = 12345678, and in some cases 12345678 = 12345677. I wish I had an actual example, but all the numerical software I use only does double-precision. In short, the results would be wrong, and it would be distracting to have to consider and then explain why software inadequacies are hopefully not affecting any conclusions. This would all be moot if the flow accumulation tool actually used double-precision, but the documentation just says FLOAT and floating point type, which in my experience has usually meant 32-bit single precision. Oliver
... View more
12-05-2012
03:38 PM
|
0
|
0
|
175
|
POST
|
I'm using flow accumulation on a large scale (an irregular area of a little less than 350M pixels). I'm expecting precision problems with float. Is it possible to use double precision?
... View more
11-28-2012
01:53 PM
|
0
|
2
|
632
|
POST
|
I'm running ArcGIS Desktop 10.0 SP5. I'm trying to write a python script to join fields from an Info table to a Coverage region and then Copy Features into a shapefile. Join Field isn't working for me (all new fields are blank), but Add Join does work when I test things. However, the qualified field names are too long for the shapefile, so they get truncated in an uninformative manner. My fields are named uniquely, so I wanted to use unqualified field names. If I set arcpy.env.qualifiedFieldNames = False, the coverage region fields are qualified and the new fields from the info table are not. If I start a fresh ArcMap session, then set arcpy.env.qualifiedFieldNames = False in the python window, I get the same results, but I noticed that I can simultaneously have arcpy.env.qualifiedFieldNames = False and GeoProcessing->Environments->Fields->Maintain fully qualified field names be checked. If I start a fresh ArcMap session, set arcpy.env.qualifiedFieldNames = False in the python window, and uncheck GeoProcessing->Environments->Fields->Maintain fully qualified field names, I get the expected/desired results. Just for kicks, if I start a fresh ArcMap session, and only uncheck GeoProcessing->Environments->Fields->Maintain fully qualified field names, I only get qualified field names. This is consistent with previously reported behavior: http://forums.esri.com/Thread.asp?c=93&f=986&t=278342&mc=4 Basically, it looks like the ArcMap GUI setting and the python setting are actually separate and both are being used.
... View more
09-09-2012
09:48 PM
|
0
|
0
|
411
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|