1

Here is my code for raster calculation in ArcGIS. However, I am getting raster file for "uw" only. The python is unable to calculate exponential integral of raster uw. Thus, I am not getting the required result which I expect after calculation as raster4. Any help from the experts would be of great help to me.

import arcpy
from arcpy import env
from arcpy.sa import *
import numpy as np
from scipy import special as sp
from scipy.special import expi

##### parameters####
rw = 0.15
S = 0.003
t = 30

#### raster band selection ####
raster1 = Raster('allowable head')
raster2 = Raster('Transmissivity')

##### well function calculation ###
uw = rw**2 * S / (4 * raster2 * t)

#### calculate exponential integral of well function ######
W_uw = -sp.expi(-uw)

##### capacity calculation ####
raster4 = (raster1 * raster2 * 4 * np.pi * t) / W_uw

expi in the code refers to "exponential integral" mathematical function which is used to solve the Euler's series. The code is executing up to "uw" only. I receive a raster output of "uw" and nothing after that.

I edited the code as per the suggestion of @Hornbydd:

##### well function calculation ###
uw = rw**2 * S / (4 * raster2 * t)

#### Convert Raster to numpy array
arr = arcpy.RasterToNumPyArray(uw,nodata_to_value=0)
### expi of array
arrexpi = -sp.expi(-arr)

# Convert Array to raster (keep origin and cellsize the same as the input)
newRaster = arcpy.NumPyArrayToRaster(arrexpi, 
                                     lowerleft,cellSize,value_to_nodata=0)

However, I still get the value of uw only and noting after that. How to set lowerleft value? Is it the X-cordinate and Y-cordinate? Please help.

0

I've never used scipy but looking at the help file for expi() it says the input is an array and if you follow the code sample it works on the array they demonstrate with.

Now if you type

type(uw)

after the line that creates uw, it returns raster and not array. I suspect thats the source of your problem?

You can convert raster into arrays using this function RasterToNumPyArray() and back into Rasters using the appropriate function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.