arcpy

arcpy + multiprocessing: error: could not save Raster dataset

耗尽温柔 提交于 2019-12-22 11:28:01
问题 I'm doing some number crunching on a raster with arcpy and want to use the multiprocessing package to speed things up. Basically, I need to loop through a list of tuples, do some raster calculations using each tuple and write some outputs to files. My inputs consist of a data raster (bathymetry), a raster that defines zones, and a tuple of two floats (water surface elevation, depth). My procedure consists of a function computeplane which takes a tuple and runs a series of raster calculations

Overlaps of all objects within the same dataset in arcpy (st_overlaps)

谁说我不能喝 提交于 2019-12-13 18:15:06
问题 The R Package sf has an amazing set of functions under the title "Geometric binary predicates" which are described in detail here. As stated in the link, the functions are recursively applied to all geometries within the same dataset if only one sf -object is provided (see example below) If y is missing, st_predicate(x, x) is effectively called, and a square matrix is returned with diagonal elements st_predicate(x[i], x[i]) . Right now however, I'm building some tools where I am bound to

AttributeError: 'DataFrame' object has no attribute 'allah1__27'

柔情痞子 提交于 2019-12-13 09:13:38
问题 I'm trying to solve this and I'm pretty sure the code is right but it keeps getting me the same Error. I have tried this: import datetime from datetime import datetime as datet test_df = shapefile.copy() test_df['timestamp'] = prediction_time test_df['allah1__27'] = shapefile.allah1__27.astype('int64') test_df['hour'] = prediction_time.hour test_df['weekday'] = prediction_time.weekday() test_df['month'] = prediction_time.month def add_join_key(df): df['join_key'] = df.allah1__27.map(int).map

Python extract data from xml and save it to excel

荒凉一梦 提交于 2019-12-12 16:15:17
问题 I would like to extract some data from an XML file and save it in a table format, such as XLS or DBF. Here is XML file i have: <?xml version="1.0" encoding="utf-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header /> <SOAP-ENV:Body> <ADD_LandIndex_001> <CNTROLAREA> <BSR> <VERB>ADD</VERB> <NOUN>LandIndex</NOUN> <REVISION>001</REVISION> </BSR> </CNTROLAREA> <DATAAREA> <LandIndex> <reportId>AMI100031</reportId> <requestKey>R3278458</requestKey>

Using CalculateField to update field with date

只愿长相守 提交于 2019-12-12 14:18:17
问题 I'm working with Arcpy in ArcGIS and trying to write code that will update a field with the last day of the previous month (ie. if I run the code today, 2017-09-01, it will update the field with 2017-08-31). If I do a manual field calculation, I can get it to work using VBScript and the pre-logic script code: Dim FC FC = DateSerial(Year(Date), Month(Date), 0) and then setting the field to equal FC: I've tried to integrate this into code so it can be set to run automatically, but haven't had

Error: None-Type error during iteration with Python

你离开我真会死。 提交于 2019-12-12 04:37:23
问题 I have created a working code to convert GPX files to feature classes in ArcGIS. Unfortunately I have ran into a file that is either corrupted or encrypted (I really don't know). I want to create an exception for these files because there may be more and I do not want these files interrupting the long process. I have tried to create an exception using python's try and except, but now I get the error "TypeError: 'NoneType' object is not iterable" for line 15 which is the FOR loop. A short

Limitation to Python's glob?

流过昼夜 提交于 2019-12-11 01:48:07
问题 I'm using glob to feed file names to a loop like so: inputcsvfiles = glob.iglob('NCCCSM*.csv') for x in inputcsvfiles: csvfilename = x do stuff here The toy example that I used to prototype this script works fine with 2, 10, or even 100 input csv files, but I actually need it to loop through 10,959 files. When using that many files, the script stops working after the first iteration and fails to find the second input file. Given that the script works absolutely fine with a "reasonable" number

Where and how can I install ArcPy for Python 2.7?

荒凉一梦 提交于 2019-12-10 14:32:45
问题 I have checked http://www.lfd.uci.edu/~gohlke/pythonlibs/, http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//003m00000002000000.htm, and https://pypi.python.org/pypi/pygeoif/0.4.1 None of these logical places can I download arcpy for installation. I have also tried Pip install arcpy. Nothing works. 回答1: ArcPy is part of ArcGIS, which is not free software. You need to obtain a license for ArcGIS to use ArcPy. If that's not an option, consider open source options, such as GDAL and

How to limit the raster processing extent using a spatial mask?

六月ゝ 毕业季﹏ 提交于 2019-12-08 20:36:29
问题 I am trying to limit raster processing in MATLAB to include only areas within a shapefile boundary, similar to how ArcGIS Spatial Analyst functions use a mask. Here is some (reproducible) sample data I am working with: A 4-band NAIP image (WARNING 169MB download) A shapefile of study area boundaries (A zipped shapefile on File Dropper) Here is a MATLAB script I use to calculate NDVI: file = 'C:\path\to\doi1m2011_41111h4nw_usda.tif'; [I R] = geotiffread(file); outputdir = 'C:\output\' %

Why does importing module in '__main__' not allow multiprocessig to use module?

孤街浪徒 提交于 2019-12-07 08:25:27
问题 I've already solved my problem by moving the import to the top declarations, but it left me wondering: Why cant I use a module that was imported in '__main__' in functions that are the targets of multiprocessing ? For example: import os import multiprocessing as mp def run(in_file, out_dir, out_q): arcpy.RaterToPolygon_conversion(in_file, out_dir, "NO_SIMPIFY", "Value") status = str("Done with "+os.path.basename(in_file)) out_q.put(status, block=False) if __name__ == '__main__': raw_input(