user1781261
user1781261

Reputation: 1

Changing some part of a function in a module

In #PSP_soil.py:

def evaporation_flux(psi):
    h_s = exp(mw*psi/(R*T)) 
    return(E_p*(h_s-h_a)/(1-h_a))

I want to change this function to:

def evaporation_flux(psi):
    h_s = exp(mw*psi/(R*T)) 
    return(h_s)

but console in spyder (Python 2.7) do not run the program (E_p and h_a are constant variables), and just show UMD has deleted: PSP_readDataFile, PSP_grid, PSP_ThomasAlgorithm, PSP_soil Any advice in this case?

Upvotes: 0

Views: 50

Answers (1)

ForceBru
ForceBru

Reputation: 44838

You can do this:

from PSP_soil import *

def evaporation_flux(psi):
    h_s = exp(mw*psi/(R*T)) 
    return(h_s)

This redefines evaporation_flux from PSP_soil so when you do evaporation_flux(value), it gets called.

from PSP_soil import * imports all constants you need for this function, but you can also do from PSP_soil import evaporation_flux, mv, R, T

Upvotes: 1

Related Questions