From 932d9b1c713913aeeb556ee495dc51d402154307 Mon Sep 17 00:00:00 2001 From: SarathUW Date: Fri, 23 Jun 2023 22:46:47 -0700 Subject: [PATCH 1/3] Bug_fix: Corrected spelling of config parser --- src/rat/cli/rat_cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rat/cli/rat_cli.py b/src/rat/cli/rat_cli.py index 67201b6..ba298e8 100644 --- a/src/rat/cli/rat_cli.py +++ b/src/rat/cli/rat_cli.py @@ -390,7 +390,7 @@ def main(): dest='global_data_dir', required=False ) - run_parser.add_argument( + configure_parser.add_argument( '-nc', '--n_cores', help='Number of cores to use for executing RAT', action='store', From 3b30d3a29b57f7f44ac518e080e51e1bc83b3584 Mon Sep 17 00:00:00 2001 From: SarathUW Date: Fri, 23 Jun 2023 22:47:00 -0700 Subject: [PATCH 2/3] Bug_fix: interpolating missing values using time,lat,lon --- .../metsim_input_processing.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/rat/data_processing/metsim_input_processing.py b/src/rat/data_processing/metsim_input_processing.py index 50401d2..efc07e6 100644 --- a/src/rat/data_processing/metsim_input_processing.py +++ b/src/rat/data_processing/metsim_input_processing.py @@ -98,16 +98,20 @@ def _read(self): self.winds[day, :, :] = wind # pbar.update(1) - def _impute_basin_missing_data(self, combined_data): - combine_nomiss_data = combined_data.where(combined_data['extent']==1,-9999) + # Imputes missing data by interpolation in the order of dimensions time, lon, lat. + def _impute_basin_missing_data(combined_data): + combine_nomiss_data = combined_data try: - combine_nomiss_data = combine_nomiss_data.interpolate_na(dim="time", method="linear", fill_value="extrapolate") + #Interpolation using time dimension - if unsuccesful values will still be NaN + combine_nomiss_data = combine_nomiss_data.interpolate_na(dim="time", method="linear", fill_value="extrapolate", limit = 30) + #Interpolation using lon dimension - if unsuccesful values will still be NaN + combine_nomiss_data = combine_nomiss_data.interpolate_na(dim="lon", method="linear", fill_value="extrapolate") + #Interpolation using lat dimension - if unsuccesful values will still be NaN + combine_nomiss_data = combine_nomiss_data.interpolate_na(dim="lat", method="linear", fill_value="extrapolate", use_coordinate=False) except: - try: - combine_nomiss_data = combine_nomiss_data.interpolate_na(dim="lon", method="linear", fill_value="extrapolate") - except: - print("No inter or extra polation can be done.") - combine_nomiss_data = combine_nomiss_data.where(combine_nomiss_data!=-9999,combined_data) + print("No inter or extra polation is possible.") + #Restoring original values outside basin extent. This ensures that ocean tiles remain to be NaN/-9999 + combine_nomiss_data = combine_nomiss_data.where(combined_data['extent']==1,combined_data) return combine_nomiss_data def _write(self): From ac78ac666c804ca02b934e299a18603e39d0feb2 Mon Sep 17 00:00:00 2001 From: SarathUW Date: Fri, 23 Jun 2023 23:00:54 -0700 Subject: [PATCH 3/3] Bug Fix: Added self as argument to _impute_basin_missing_data --- src/rat/data_processing/metsim_input_processing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rat/data_processing/metsim_input_processing.py b/src/rat/data_processing/metsim_input_processing.py index efc07e6..474e52f 100644 --- a/src/rat/data_processing/metsim_input_processing.py +++ b/src/rat/data_processing/metsim_input_processing.py @@ -99,7 +99,7 @@ def _read(self): # pbar.update(1) # Imputes missing data by interpolation in the order of dimensions time, lon, lat. - def _impute_basin_missing_data(combined_data): + def _impute_basin_missing_data(self, combined_data): combine_nomiss_data = combined_data try: #Interpolation using time dimension - if unsuccesful values will still be NaN