diff --git a/CHANGELOG.md b/CHANGELOG.md
index 78b3659..9457a4a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [Unreleased]## [0.5.4.5b0]
+### Changed
+
+## [0.5.4.4] - 2022-04-28
+### Added
+- ScenarioManager.load_data_from_zip_csv_s: loading input data from a zipped archive of csv files
+- ScenarioManager.write_data_to_zip_csv_s: writing input/output data as a zipped archive of csv files
+### Removed
+- ScenarioManager.write_data_to_csv_s no longer adds files as data assets
+
## [0.5.4.3] - 2022-04-21
### Changed
- Fixed indentation bug in domodeldeployer
diff --git a/docs/doc_build/doctrees/dse_do_utils.doctree b/docs/doc_build/doctrees/dse_do_utils.doctree
index 978251d..29b44f8 100644
Binary files a/docs/doc_build/doctrees/dse_do_utils.doctree and b/docs/doc_build/doctrees/dse_do_utils.doctree differ
diff --git a/docs/doc_build/doctrees/environment.pickle b/docs/doc_build/doctrees/environment.pickle
index 29d9c00..012c290 100644
Binary files a/docs/doc_build/doctrees/environment.pickle and b/docs/doc_build/doctrees/environment.pickle differ
diff --git a/docs/doc_build/html/.buildinfo b/docs/doc_build/html/.buildinfo
index 8bab9a6..f454eb1 100644
--- a/docs/doc_build/html/.buildinfo
+++ b/docs/doc_build/html/.buildinfo
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: a2fef2d4d97989a7a252359bf54f6f01
+config: f8f9929cad760595d068a901248ae903
tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/docs/doc_build/html/_modules/dse_do_utils.html b/docs/doc_build/html/_modules/dse_do_utils.html
index 5ec0f7a..5e77e88 100644
--- a/docs/doc_build/html/_modules/dse_do_utils.html
+++ b/docs/doc_build/html/_modules/dse_do_utils.html
@@ -6,7 +6,7 @@
- dse_do_utils — DSE DO Utils 0.5.4.2 documentation
+ dse_do_utils — DSE DO Utils 0.5.4.4 documentation
@@ -31,7 +31,7 @@
else:param=raw_paramelse:
- print('Warning: {} not in Parameters'.format(param_name))
+ print(f'Warning: {param_name} not in Parameters. Using default value = {default_value}')# If datetime, the default value can be a stringimportsix# For Python 2 and 3 compatibility of testing string instanceifparam_type=='datetime'andisinstance(default_value,six.string_types):
@@ -456,7 +456,7 @@
+ # -----------------------------------------------------------------
+ # Read from / write to zipped set of csv files
+ # -----------------------------------------------------------------
+
[docs]@staticmethod
+ defload_data_from_zip_csv_s(zip_file_path:str,file_size_limit:int=None,**kwargs)->Dict[str,pd.DataFrame]:
+ """Read data from a zip file with .csv files.
+
+ Args:
+ zip_file_path (str): the full path of a zip file containing one or more .csv files.
+ file_size_limit (int): maximum file size in bytes. None implies no limit.
+ **kwargs: Set of optional arguments for the pd.read_csv() function
+
+ Returns:
+ data: dict of DataFrames. Keys are the .csv file names.
+ """
+ inputs={}
+
+ withzipfile.ZipFile(zip_file_path,"r")asf:
+ forcsv_fileinf.infolist():
+ ifpathlib.Path(csv_file.filename).suffix.lower()=='.csv':
+ table_name=pathlib.Path(csv_file.filename).stem
+ # print(f"Reading table = {table_name}. File-size = {convert_size(csv_file.file_size)}")
+ iffile_size_limitisNoneorcsv_file.file_size<=file_size_limit:
+ df=pd.read_csv(f.open(csv_file.filename),**kwargs)
+ inputs[table_name]=df
+ #print(f"Read {table_name}: {df.shape[0]} rows and {df.shape[1]} columns")
+ else:
+ pass
+ #print(f"Read {table_name}: skipped")
+
+ returninputs
+
+
[docs]@staticmethod
+ defwrite_data_to_zip_csv_s(zip_file_path:str,inputs:Inputs=None,outputs:Outputs=None,**kwargs):
+ """Write data as a zip file with .csv files.
+ inputs and outputs dictionaries are merged and written in same zip.
+
+ Args:
+ zip_file_path (str): the full path of a zip file.
+ inputs: dict of input DataFrames
+ outputs: dict of input DataFrames
+ **kwargs: Set of optional arguments for the df.to_csv() function
+
+ Returns:
+ None
+ """
+ dfs={}
+ ifinputsisnotNone:
+ dfs={**dfs,**inputs}
+ ifoutputsisnotNone:
+ dfs={**dfs,**outputs}
+ withzipfile.ZipFile(zip_file_path,'w')aszipMe:
+ withtempfile.TemporaryDirectory()astmpdir:
+ fortable_name,dfindfs.items():
+ filename=table_name+".csv"
+ file_path=os.path.join(tmpdir,filename)
+ # print(f"Write table {table_name}, rows = {df.shape[0]} as {file_path}")
+ df.to_csv(file_path,index=False,**kwargs)
+ zipMe.write(file_path,arcname=filename,compress_type=zipfile.ZIP_DEFLATED)