Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress Output #39

Open
apreucil opened this issue Mar 23, 2022 · 5 comments
Open

Suppress Output #39

apreucil opened this issue Mar 23, 2022 · 5 comments

Comments

@apreucil
Copy link

Anyone know a way to suppress this output every time I am reading a variable with read_ts? Thanks!
image

@ryanjcahill
Copy link

I saw this was resolved in an earlier comment, but the resolution didn't work for me. I tried the suggested fix from the link below, but it had no effect. Perhaps the functionality changed? I'm using 2.2.

from pydsstools.heclib.utils import dss_logging
dss_logging.config(level='None')

#16 (comment)

@apreucil
Copy link
Author

Thanks Ryan, I also am on 2.2. I also tried to add the suggested code and it did not have an effect for me either. I'm using python 3.7, if that helps.

@apreucil
Copy link
Author

apreucil commented Apr 6, 2022

I upgraded to python version 3.9 this morning, and installed the pydsstools for 3.9. I am no longer getting the extra output when reading the DSS files, so all good! But there may be a problem in the 3.7 distribution. Again, not a huge deal (especially since I upgraded and am no longer having the issue) but if you wanted to check into it, seems like it's isolated to the 3.7 distribution. Thanks!

@ryanjcahill
Copy link

Darn, I upgraded to Python 3.9, but it didn't work for me--the messages still keep popping up.

@dwr-zroy
Copy link

dwr-zroy commented May 31, 2023

I added the logging suppression to my script and I still am seeing the output. I am running Python 3.11.3, with pydsstools==2.3 (installed from wheel pydsstools-2.3-cp311-cp311-win_amd64.whl).

import pandas as pd

from pydsstools.heclib.dss import HecDss
from pydsstools.heclib.utils import dss_logging

def get_all_ts(src, paths) -> pd.DataFrame:
    with HecDss.Open(src) as DSS:
        dss_logging.config(level=0)
        for p in paths:
            struct = DSS.read_ts(p)
            df = pd.DataFrame(
                struct.values,
                index=struct.times,
                columns=['VALUE']
            )
            df.index.name = 'TIME'
            df['PATH'] = p
            
            yield df

def get_paths(src, pattern: str = '*') -> set:
    with HecDss.Open(src) as DSS:
        dss_logging.config(level=0)
        v = DSS.getPathnameList(pattern)
    return set(v)

if __name__ == '__main__':
    paths = get_paths(FILE)
    for df in get_all_ts(FILE, paths):
        pass

Output appears as (first 10 reads):

    -----DSS---ZOPEN:  Existing File Opened,  File: 
<<<FILE>>>
                       Unit:    3;  DSS Versions - Software: 6-YO, File: 6-WC,  Library 7-IQ
WARNING:root:***Setting DSS Logging, Method = 0, Level = 0***
    -----DSS---zclose6 Unit:    3,   File: <<<FILE>>>
               Pointer Utilization: 30.90
               Number of Records: 251210
               File Size: 343301.9  Kbytes
               Percent Inactive:   0.0
               Number of Reads:    62354
    -----DSS---ZOPEN:  Existing File Opened,  File: 
<<<FILE>>>
                       Unit:    3;  DSS Versions - Software: 6-YO, File: 6-WC,  Library 7-IQ
WARNING:root:***Setting DSS Logging, Method = 0, Level = 0***
 -----DSS---ZREAD Unit    3; Vers.    1:  /CALSIM/DL_25_PU/DELIVERY-LOSS/01JAN1930/1MON/L2020A/
 -----DSS---ZREAD Unit    3; Vers.    1:  /CALSIM/SHORT_SWP_TOT_S_WHEELJPOD/DELIVERY-SHORTAGE-SWP/01JAN1920/1MON/L2020A/
 -----DSS---ZREAD Unit    3; Vers.    1:  /CALSIM/S_SLUIS_SWP_2/STORAGE-ZONE/01JAN2000/1MON/L2020A/
 -----DSS---ZREAD Unit    3; Vers.    1:  /CALSIM/C_FTR053/CHANNEL/01JAN1950/1MON/L2020A/
 -----DSS---ZREAD Unit    3; Vers.    1:  /CALSIM/SWP_IN_SOD_CYCGW1/NDD-QAQC/01JAN1960/1MON/L2020A/
 -----DSS---ZREAD Unit    3; Vers.    1:  /CALSIM/DN_72_PR4/SW_DELIVERY-NET/01JAN2000/1MON/L2020A/
 -----DSS---ZREAD Unit    3; Vers.    1:  /CALSIM/SG_SACAB_CYCUP/NDD-QAQC/01JAN2020/1MON/L2020A/
 -----DSS---ZREAD Unit    3; Vers.    1:  /CALSIM/I_FOLSM_FM_MED_DV__FUT__1/FORECASTED-INFLOW-MEDIAN/01JAN2000/1MON/L2020A/
 -----DSS---ZREAD Unit    3; Vers.    1:  /CALSIM/FRESPILL_20DV/FLOW-DELIVERY/01JAN2020/1MON/L2020A/
 -----DSS---ZREAD Unit    3; Vers.    1:  /CALSIM/SLACK__FIXD_WTPBUK_03_SU_1/SLACK/01JAN1980/1MON/L2020A/
 -----DSS---ZREAD Unit    3; Vers.    1:  /CALSIM/SHORT_NBA_LOSS/DELIVERY-SHORTAGE/01JAN1930/1MON/L2020A/
    -----DSS---zclose6 Unit:    3,   File: <<<FILE>>>
               Pointer Utilization: 30.90
               Number of Records: 251210
               File Size: 343301.9  Kbytes
               Percent Inactive:   0.0
               Number of Reads:      247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants