From fe5a5ee99e587032a413fd3a495be53084251950 Mon Sep 17 00:00:00 2001 From: Nicky Sandhu Date: Fri, 6 Dec 2024 15:58:21 -0800 Subject: [PATCH] adding commands to setup --- dms_datastore/download_cimis.py | 6 +++++- dms_datastore/download_ucdipm.py | 8 +++++++- setup.py | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dms_datastore/download_cimis.py b/dms_datastore/download_cimis.py index e33dc54..f5fd384 100644 --- a/dms_datastore/download_cimis.py +++ b/dms_datastore/download_cimis.py @@ -360,7 +360,7 @@ def cache_to_pkl(self, dfstations): print(dfstations[dfstations["Station Number"].isin(failed_stations)]) -if __name__ == "__main__": +def main(): password = os.environ.get("CIMIS_PASSWORD", default="xxx") cx = CIMIS(password=password) dfcat = cx.get_stations_info() @@ -383,3 +383,7 @@ def cache_to_pkl(self, dfstations): except Exception as e: print(f"Error: {e}") continue + + +if __name__ == "__main__": + main() diff --git a/dms_datastore/download_ucdipm.py b/dms_datastore/download_ucdipm.py index e1bf81e..b8336d6 100644 --- a/dms_datastore/download_ucdipm.py +++ b/dms_datastore/download_ucdipm.py @@ -17,7 +17,9 @@ def get_weather_data(start_date, end_date, stnKey=281): # argparse for calling get_weather_data from command line -if __name__ == "__main__": + + +def main(): import argparse parser = argparse.ArgumentParser() @@ -27,3 +29,7 @@ def get_weather_data(start_date, end_date, stnKey=281): args = parser.parse_args() df = get_weather_data(args.start_date, args.end_date) df.to_csv(f"ucdipm_{args.stnKey}.csv") + + +if __name__ == "__main__": + main() diff --git a/setup.py b/setup.py index 9e9f433..f528c50 100644 --- a/setup.py +++ b/setup.py @@ -67,6 +67,8 @@ "download_des=dms_datastore.download_des:main", "download_ncro=dms_datastore.download_ncro:main", "download_mokelumne=dms_datastore.download_mokelumne:main", + "download_ucdipm=dms_datastore.download_ucdipm:main", + "download_cimis=dms_datastore.download_cimis:main", "compare_directories=dms_datastore.compare_directories:main", "populate_repo=dms_datastore.populate_repo:main", "station_info=dms_datastore.station_info:main",