|
POST
|
Ah, sorry, didn't notice you had abandoned the numpy array approach. Just replace the last lines with: for i in range(len(filenames)): print(filenames) eq = a + b * lat + c * lon + d * alt eq.save(filenames)
... View more
09-18-2018
10:05 AM
|
0
|
1
|
1785
|
|
POST
|
Still several things going on here: - Seems you have forgot to cast the numpy array to raster before saving: eqraster = arcpy.NumPyArrayToRaster(eqarr, lowerleft, cellsize, cellsize) eqraster.save(filename) - The list comprehension on line 29 runs inside the save loop. If you want to calculate everything into the big list of arrays you should do it at line 21. - There are no georeferencing of the results.
... View more
09-18-2018
07:32 AM
|
0
|
1
|
1785
|
|
POST
|
Guess your problem here is that you has forgot to convert alt to a raster, so in line 30 it's a string. A working copy from the data you added earlier: import arcpy arcpy.CheckOutExtension("Spatial") arcpy.env.overwriteOutput = True WKSP = "C:/temp/datarar" # Folder with raster datasets. arcpy.env.workspace = WKSP # Input raster datasets of the same masked area and same spatial reference # Get lower left corner and cell size to georeference output latraster = arcpy.Raster("latit.tif") lowerleft = arcpy.Point(latraster.extent.XMin, latraster.extent.YMin) cellsize = latraster.meanCellWidth lat = arcpy.RasterToNumPyArray(latraster) # Input lat raster del latraster lon = arcpy.RasterToNumPyArray("longit.tif") # Input lon raster alt = arcpy.RasterToNumPyArray("mde_sc_90.tif") # Input dem raster eqtbl = "Raster_Clima.gdb/TB_EQUAC_ETP2" arr = arcpy.da.TableToNumPyArray(eqtbl, "*") filenames = ["{}_{}.tif".format(*x) for x in arr[["SG_PREFIX", "SG_PERIO"]]] a = arr["VL_A"] b = arr["VL_B"] c = arr["VL_C"] d = arr["VL_D"] # Working with large arrays this may be memory intensive. # arrs = [a + b * lat + c * lon + d * alt for i in range(len(a))] i = 0 for filename in filenames: print(filename) # A bit more memory friendly alternative to arrs eqarr = a + b * lat + c * lon + d * alt eqraster = arcpy.NumPyArrayToRaster(eqarr, lowerleft, cellsize, cellsize) eqraster.save(filename) i += 1
... View more
09-17-2018
11:39 AM
|
0
|
7
|
2028
|
|
POST
|
Guess your second example demonstrates just what happens, unfortunately the tool just exits instead of giving a error message, but I have managed to get the error to exit python without giving an error message too so might be a numpy problem. >>> dt = np.dtype([('name', np.unicode_, 2147483647), ('grades', np.float64, (2,))]) >>> dt['name'] dtype('<U-1') >>> x = np.array([('Sarah', (8.0, 7.0)), ('John', (6.0, 7.0))], dtype=dt) >>> x (arcgis15) C:\ Anyway, the dtype conversion is as documented. See the Type conversions part here Working with NumPy in ArcGIS—ArcPy Get Started | ArcGIS Desktop, and as long as you are aware of your schema the problem shouldn't be too hard to avoid.
... View more
09-16-2018
08:19 AM
|
0
|
1
|
2028
|
|
POST
|
The schema in the GDB isn't broken per se, that's why I put exclamation marks around 'broken'. The GDB has no problems with the schema, but it breaks the conversion to numpy array as the np.array can't handle a dtype of <u2147483647. If he instead had read the data directly from the GDB with a cursor the problem hadn't occured.
... View more
09-16-2018
07:32 AM
|
0
|
3
|
2028
|
|
POST
|
Guess that explains why you got <u255, but to see why his code crashed at arr = arcpy.da.TableToNumPyArray(tbl, "*") we had to look at his own gdb, and it had a 'broken' schema.
... View more
09-15-2018
01:02 AM
|
0
|
5
|
2028
|
|
POST
|
Is that what you got from converting the xlsx? I just looked at the gdb file he posted here.
... View more
09-14-2018
02:06 PM
|
0
|
7
|
2227
|
|
POST
|
Hi, Luiz guess you should have a look at your gdb. Looks like all text fields in the tables are defined with a width of 2147483647. When converting to a numpy array all string fields will be converted to fields of the same width, and my guess is that numpy doesn't cope with eight <u2147483647 columns in the array. Tested, and after moving your table to a new table with more moderate field widths the function works ok.
... View more
09-14-2018
01:26 PM
|
0
|
18
|
2227
|
|
POST
|
Guess I could, but the take from What is the preferred way to report found bugs in the Python API? and https://community.esri.com/thread/196929-geonet-or-github-for-technical-questions-about-api was that GeoNet was the preferred channel for this kind of reports.
... View more
09-12-2018
04:24 AM
|
0
|
1
|
2354
|
|
POST
|
Hi, it seems importing the GIS breaks a former from time import time import as demonstrated in the following example. Switching the imports works, but it's not intuitive, and neither very PEP 8. It seems time.sleep() is the only function from the time module that are used in the API, and it is only used twice, in Item.export() and Item._check_publish_status(). Still, there are three instances of import time scattered around in the __init__.py file. Wouldn't it be better to narrow the import to a from time import sleep in the imports at top of the file?
... View more
09-12-2018
12:01 AM
|
0
|
11
|
3128
|
|
POST
|
Hi - Atma Mani, just tested the aforementioned update bug with the new 1.5 API, but except for the line numbers nothing seems to have changed. Still works fine with ArcGIS Online.
... View more
08-20-2018
12:04 AM
|
0
|
0
|
2771
|
|
POST
|
Well, Jupyter is there by default already, and for us preferring a different IDE, shipping the default with Spyder will just be noise. But Spyder could of course be an option when installing. IMHO keeping the default read only and support cloned environments is a good approach as long as the Environment manager works.
... View more
08-17-2018
07:31 AM
|
0
|
8
|
1274
|
|
POST
|
Thank you Ghislain Prince, I almost wrote your post on Monday when running conda clean --all (as admin) fixed the issue om my computer. Then I did a bit more testing and found that clean was no silver bullet. Of the 6 installations I have tested, 5 had the problem. Clean only fixed one of those entirely. (Allow for cloning from inside Pro) Of the other four installations, cleaning allowed creating new environments on two, but still didn't allow cloning of the arcgispro-py3 environment. A conda list --explicit on a troubled computer shows that the arcgispro-py3 environment references some packages more than one time with different versions. # This file may be used to create an environment using:
# $ conda create --name --file
# platform: win-64
@EXPLICIT
https://conda.anaconda.org/esri/win-64/arcgis-1.4.1-py36h52c3b5e_1.tar.bz2
https://conda.anaconda.org/esri/win-64/arcgispro-2.2-0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/asn1crypto-0.24.0-py36_0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/atomicwrites-1.1.5-py36_0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/attrs-17.4.0-py36_0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/attrs-18.1.0-py36_0.tar.bz2
https://repo.anaconda.com/pkgs/main/win-64/backcall-0.1.0-py36_0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/bleach-2.1.3-py36_0.tar.bz2
https://repo.anaconda.com/pkgs/main/win-64/ca-certificates-2018.03.07-0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/certifi-2018.1.18-py36_0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/certifi-2018.4.16-py36_0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/cffi-1.11.5-py36h945400d_0.tar.bz2
... In a vanilla install of Pro 2.2 none of these duplicates occurs. Before upgrade, the Pro 2.1.3 environment on this computer looked like: # This file may be used to create an environment using:
# $ conda create --name --file
# platform: win-64
@EXPLICIT
https://conda.anaconda.org/esri/win-64/arcgis-1.2.5-py36_1.tar.bz2
https://conda.anaconda.org/esri/win-64/arcgispro-2.1-0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/asn1crypto-0.24.0-py36_0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/atomicwrites-1.1.5-py36_0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/attrs-18.1.0-py36_0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/backcall-0.1.0-py36_0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/bleach-2.1.3-py36_0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/ca-certificates-2018.03.07-0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/certifi-2018.4.16-py36_0.tar.bz2
https://repo.continuum.io/pkgs/main/win-64/cffi-1.11.5-py36h945400d_0.tar.bz2
... As you can see the Pro2.2 comes with older versions of the packages, and some packages like ca-certificates have changed repo from continuum.io to anaconda.com. After cleaning creating of new environments on this computer works fine, but cloning of the arcgispro-py3 still gives: ERROR conda.core.link:_execute_actions(337): An error occurred while installing package 'defaults::python-3.6.5-h0c2934d_0'.
CondaError: Cannot link a source that does not exist. C:\Program Files\ArcGIS\Pro\bin\Python\pkgs\python-3.6.5-h0c2934d_0\Lib\__pycache__\__future__.cpython-36.pyc
Attempting to roll back.
CondaError: Cannot link a source that does not exist. C:\Program Files\ArcGIS\Pro\bin\Python\pkgs\python-3.6.5-h0c2934d_0\Lib\__pycache__\__future__.cpython-36.pyc PS: I know I should use a clone if the environment are to be used inside Pro, but it is not necessary to clone it to test for the bug. As you know, before cleaning it pops up on plain creates as well
... View more
07-06-2018
04:52 AM
|
1
|
1
|
8113
|
|
POST
|
This is possible using conda from the Python Command Prompt. From there you may clone environments to your chosen location. conda create --clone arcgispro-py3 --prefix c:\mydir\myclone note that if you put your environment outside the defined envs directories they will not be listed using conda info --envs But you may still activate the environment, and all conda functionality are available, but you must use full path to the environment. Set active: activate c:\mydir\myclone Or just reference the clone with a full path when running conda commands: conda install --name c:\mydir\myclone flask NB: At the moment you may hit the issue described here https://community.esri.com/thread/217048-arcgis-pro-220-and-python-package-manager?sr=inbox&ru=159379 but I guess there will be a fix out soon.
... View more
07-04-2018
07:31 AM
|
1
|
1
|
2663
|
|
POST
|
Oops, but my bad. Seems the Geometry() function is not available in Pro, only in Enterprise and AGOL
... View more
06-28-2018
02:01 AM
|
0
|
0
|
4506
|
| Title | Kudos | Posted |
|---|---|---|
| 4 | 07-04-2023 07:23 AM | |
| 1 | 05-27-2022 07:34 AM | |
| 1 | 09-14-2021 12:26 AM | |
| 1 | 01-30-2019 11:35 PM | |
| 1 | 08-01-2019 04:27 AM |
| Online Status |
Offline
|
| Date Last Visited |
3 weeks ago
|