Skip to content

ZRW_WestIndian Error 2 #8

@steveskrip

Description

@steveskrip

Received following error when attempting to read_UCI using the ZRW_WestIndian .uci file. Still working on a workaround.

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-8-af0364dabdb1> in <module>
      1 from readUCI import read_UCI
----> 2 read_UCI(filepath+'hspf.uci', filepath+'hspf.h5')
~\Documents\GitHub\HSPsquared\HSP2\readUCI.py in read_UCI(uciname, hdfname)
    869             if line[0:7] == 'FTABLES':      ftables(info, getlines(f))
    870             if line[0:3] == 'EXT':              ext(info, getlines(f))
--> 871             if line[0:6] == 'PERLND':     operation(info, getlines(f),'PERLND')
    872             if line[0:6] == 'IMPLND':     operation(info, getlines(f),'IMPLND')
    873             if line[0:6] == 'RCHRES':     operation(info, getlines(f),'RCHRES')
~\Documents\GitHub\HSPsquared\HSP2\readUCI.py in operation(info, llines, op)
   1132                 df = concat(x)
   1133                 df.columns = Months
-> 1134                 df = fix_df(df, op, save, ddfaults, valid)
   1135                 df.to_hdf(store, f'{op}/{save}/MONTHLY/{name}', data_columns=True)
   1136         elif cat == 'EXTENDED':
~\Documents\GitHub\HSPsquared\HSP2\readUCI.py in fix_df(df, op, save, ddfaults, valid, sortflag)
    645     if df.isna().any().any():                      # replace NaNs with defaults
    646         for col in df.columns:
--> 647             df[col] = df[col].fillna(ddfaults[op, save, col])
    648     if sortflag:
    649         df = df.sort_index(axis=1)
KeyError: ('PERLND', 'PWATER', 'JAN')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions