From c6fea84277c6c16a6ed4148dd50463b4d7741a75 Mon Sep 17 00:00:00 2001 From: Rachel Woods-Robinson Date: Sat, 31 May 2025 21:12:21 -0700 Subject: [PATCH 1/2] rwr contributor agreement --- contributors/rwoodsrobinson.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 contributors/rwoodsrobinson.md diff --git a/contributors/rwoodsrobinson.md b/contributors/rwoodsrobinson.md new file mode 100644 index 00000000..f358b076 --- /dev/null +++ b/contributors/rwoodsrobinson.md @@ -0,0 +1,12 @@ +2023-10-24 + +I hereby agree to the terms of the Contributors License Agreement, +version 1.0, with MD5 checksum c54efab3bc98a2ca5e631c204a58a15c. + +I furthermore declare that I am authorized and able to make this +agreement and sign this declaration. + +Signed, + +Rachel Woods-Robinson +https://github.com/rwoodsrobinson \ No newline at end of file From 2eabf5d74d21ed549c55c6efe5f34d3d6087431a Mon Sep 17 00:00:00 2001 From: Rachel Woods-Robinson Date: Sun, 1 Jun 2025 16:57:25 -0700 Subject: [PATCH 2/2] update main.py init to save raw files --- PV_ICE/main.py | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/PV_ICE/main.py b/PV_ICE/main.py index 7e517e1d..b3222c21 100644 --- a/PV_ICE/main.py +++ b/PV_ICE/main.py @@ -2683,33 +2683,38 @@ class Material: def __init__(self, materialname, massmatfile, energymatfile=None): self.materialname = materialname + # Load mass material file if massmatfile is None: try: - massmatfile = _interactive_load('Select material baseline ' + - 'file') - except: - raise Exception('Interactive load failed. Tkinter not ' + - 'supported on this system. Try installing ' + - 'X-Quartz and reloading') + massmatfile = _interactive_load('Select material baseline file') + except Exception: + raise RuntimeError('Interactive load failed. Tkinter not supported. ' + 'Try installing XQuartz (macOS) and reloading.') data, meta = _readPVICEFile(massmatfile) - self.massmatfile = massmatfile self.matmetdataIn_m = meta self.matdataIn_m = data - # SAVING A COPY TO RAW - # Joining the metdata back in - foometa = pd.DataFrame(meta, index=[0]) - foodata = pd.concat([foometa, data], axis=0) - # Removing the path to just get the filename - # TODO - find fancy python way, this will probably break on a mac + # Save a copy to /raw/ folder try: - foomassmatfile = massmatfile.split('\\')[-1] - foodata.to_csv(os.path.join('raw', materialname + '_' + - foomassmatfile)) - except: - print("Can't save raw files on macs yet.") + raw_dir = Path("raw") + raw_dir.mkdir(exist_ok=True) # Create directory if it doesn't exist + + # Get filename only, regardless of OS + foomassmatfile = Path(massmatfile).name + + # Combine meta and data into one DataFrame + foometa = pd.DataFrame(meta, index=[0]) + foodata = pd.concat([foometa, data], axis=0) + + # Construct output path and save + output_path = raw_dir / f"{materialname}_{foomassmatfile}" + foodata.to_csv(output_path, index=False) + except Exception as e: + print(f"[Warning] Could not save raw material file: {e}") + + # Optional energy file if energymatfile is not None: self.addEnergytoMaterial(energymatfile) else: