respec / HSPsquared

Hydrologic Simulation Program Python (HSPsquared)
GNU Affero General Public License v3.0
43 stars 17 forks source link

Warning Message while processing RCHRES 'extrapolation of rchtab will take place' vanishes when repeating the run. #15

Closed AtrCheema closed 6 months ago

AtrCheema commented 6 years ago

I am running a for loop to on HSP2.run method, problem is, it shows warning message

2018-04-03 18:44:14.34 Message count 2 Message HYDR: extrapolation of rchtab will take place 2018-04-03 18:44:14.34 Message count 1 Message HYDR: Solve did not converge

But when I rerun the same file again, these messages are vanished. What more worse is that sometimes the warning message is vanished on third run and not even on second run. I am using following code to run the HDF5 file.

`

def ROR8D(hdfname):      # getting calculated RO from HDF
    bf_p1 = pd.read_hdf(hdfname, 'RESULTS/RCHRES_R009/HYDR')['RO']
    outflow = bf_p1#*0.028316847     # convert cfs to cms
    OutflowR8D = outflow.resample('D').mean()
    #print('now total outflow is {}'.format(sum(OutflowR8D)))
    if isinf(sum(OutflowR8D)):         # check if any value of calculated RO is infinity, 
        print(sum(OutflowR8D[1:]))
        print('infinity aa gya hai')
        #sys.exit()
        OutflowR8D = OutflowR8D.replace([np.inf, -np.inf], 0.0)  # replacing infinity values with 0.0
        print(sum(OutflowR8D))
    return OutflowR8D

def ObjectiveFunction(xx):    #xx is a list of input parameters

    #changing parameters 
    df2 = pd.read_hdf(hdfname, '/PERLND/PWATER/PARAMETERS') 
    print('sum of all input parameters is {0:10.7f}'.format(sum(xx)))    
    df2.LZSN   = xx[0]
    df2.INFILT = xx[1]
    df2.KVARY  = xx[2]
    df2.AGWRC  = xx[3]
    df2.DEEPFR = xx[4]
    df2.BASETP = xx[5]
    df2.AGWETP = xx[6]
    df2.CEPSC  = xx[7]
    df2.UZSN   = xx[8]
    df2.INTFW  = xx[9]
    df2.IRC    = xx[10]
    df2.LZETP  = xx[11]
    df2.NSUR   = xx[12]

    df2.to_hdf(hdfname, '/PERLND/PWATER/PARAMETERS')    

    HSP2.run(hdfname, saveall=True)

    OutflowR8D = ROR8D(hdfname)
    TotalFlow = sum(OutflowR8D)
    #print('\n total flow is {} '.format(TotalFlow))

    while isnan(TotalFlow):                     # rerunning if run gave errors in first run
        print('             ...........Rerunning............. ')
        HSP2.run(hdfname, saveall=True)

        OutflowR8D = ROR8D(hdfname)
        TotalFlow = sum(OutflowR8D)`
PaulDudaRESPEC commented 6 years ago

Can you tell us about the computational environment? Are you running Windows? 32 or 64 bit? Python version, numpy and numba versions, etc.

AtrCheema commented 6 years ago

Windows 7, 64 bit Numpy Version 1.14.2 Numba Version: 0.35.0+10.g143f70e.dirty Python 2.7 on Anaconda.

PaulDudaRESPEC commented 6 years ago

Would you be willing to share the h5 file that produces the warnings? Either here or privately?

PaulDudaRESPEC commented 6 years ago

Given that h5 file, I am able to run HSP2 on it without getting that warning (or any warnings/errors for that matter). The warning message that you see is one that you might get if your input parameters are not getting set as intended -- maybe you are starting with a bad value in your xx array?

PaulDudaRESPEC commented 6 months ago

Closing this one related to python 2.7 version