From 6cb562deaa3e912fdd4629524fff8d24bea714fb Mon Sep 17 00:00:00 2001 From: Carlotta Date: Wed, 5 Feb 2025 16:11:59 +0100 Subject: [PATCH 1/3] Removed 0 obs values in final arrays --- mapies/viirs.py | 24 ++++++++++++++++-------- run/run_viirs.py | 12 ++++++------ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/mapies/viirs.py b/mapies/viirs.py index 6feb60e2..a3014707 100644 --- a/mapies/viirs.py +++ b/mapies/viirs.py @@ -313,11 +313,12 @@ class VIIRS(MAPIES): ) # Update the monthly dictionary + valid_obs = final_obs > 0 self.monthly_dict[month] = { - "lon": final_lon, - "lat": final_lat, - "obs": final_obs, - "count": cumulative_count, + "lon": final_lon[valid_obs], + "lat": final_lat[valid_obs], + "obs": final_obs[valid_obs], + "count": cumulative_count[valid_obs], } print(f'Updated monthly dictionary for month {month}') print(f'Lon shape: {final_lon.shape}, Lat shape: {final_lat.shape}, Obs shape: {final_obs.shape}') @@ -336,10 +337,17 @@ class VIIRS(MAPIES): final_lon, final_lat, final_obs, cumulative_count = self.process_monthly_data( batch_size=batch_size, month=None ) - self.lon_values = final_lon - self.lat_values = final_lat - self.obs = final_obs - self.count_obs = cumulative_count + valid_obs = final_obs > 0 + self.lon_values = final_lon[valid_obs] + self.lat_values = final_lat[valid_obs] + self.obs = final_obs[valid_obs] + self.count_obs = cumulative_count[valid_obs] + + # self.lon_values = final_lon + # self.lat_values = final_lat + # self.obs = final_obs + # self.count_obs = cumulative_count + except Exception as e: print(f"Error processing data for the time period from {self.start_date} to {self.end_date}: {e}") return diff --git a/run/run_viirs.py b/run/run_viirs.py index bd8b1504..e54b8e76 100644 --- a/run/run_viirs.py +++ b/run/run_viirs.py @@ -10,8 +10,8 @@ if __name__ == "__main__": # end__datedate = "202401030236" # 00:30 to 16:36 of 2024-01-01 - start_date = "202401010030" - end_date = "202401011636" + # start_date = "202401010030" + # end_date = "202401011636" # ONE YEAR # start_date = "202401300000" @@ -19,8 +19,8 @@ if __name__ == "__main__": # end_date = "202402022359" # ONE MONTH - JANUARY 2024 - # start_date = "202401010000" - # end_date = "202401312359" + start_date = "202401010000" + end_date = "202401312359" # outdir="/home/cmeikle/Projects/data/" # indir="/home/cmeikle/Projects/data/VIIRS/original_files/AERDB_L2_VIIRS_NOAA20" @@ -28,8 +28,8 @@ if __name__ == "__main__": # indir = "/home/cgile/bscearth000/esarchive/obs/nasa/viirs_noaa20_aerdb_l2/original_files/VIIRS" indir = "/home/cgile/Documents/mapies/VIIRS" - filename_obs = 'carlotta' - filename_num_obs = 'carlotta' + filename_obs = '1month_obs' + filename_num_obs = '1month_num_obs' start_time = time.time() -- GitLab From 8018aec46aebdbaaf05a01b39becb0788faed453 Mon Sep 17 00:00:00 2001 From: Calum Meikle Date: Mon, 10 Feb 2025 12:28:39 +0100 Subject: [PATCH 2/3] Updated run file to be frozen when added to gitignore --- run/run_viirs.py | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/run/run_viirs.py b/run/run_viirs.py index 6ac94d85..dfc2bc35 100644 --- a/run/run_viirs.py +++ b/run/run_viirs.py @@ -6,29 +6,14 @@ import time if __name__ == "__main__": # Change these variables # 00:30 to 02:36 from 2024-01-01 to 2024-01-03 - # start_date = "202401010030" - # end__datedate = "202401030236" + start_date = "202401010030" + end_date = "202401030236" - # 00:30 to 16:36 of 2024-01-01 - # start_date = "202401010030" - # end_date = "202401011636" + filename_obs = '1month_obs.png' + filename_num_obs = '1month_num_obs.png' - # ONE YEAR - # start_date = "202401300000" - # end_date = "202412312359" - # end_date = "202402022359" - - # ONE MONTH - JANUARY 2024 - start_date = "202401010000" - end_date = "202401312359" - - filename_obs = '1month_obs' - filename_num_obs = '1month_num_obs' - outdir="/home/cmeikle/Projects/data/" - indir="/home/cmeikle/Projects/data/VIIRS" - - #outdir = "/home/cgile/Documents/mapies/figures" - # indir = "/home/cgile/bscearth000/esarchive/obs/nasa/viirs_noaa20_aerdb_l2/original_files/VIIRS" + outdir = "/home/cgile/Documents/mapies/figures" + indir = "/home/cgile/bscearth000/esarchive/obs/nasa/viirs_noaa20_aerdb_l2/original_files/VIIRS" # indir = "/home/cgile/Documents/mapies/VIIRS" -- GitLab From a9857533031b413963c9c8fc557f8c0218e5cdfa Mon Sep 17 00:00:00 2001 From: Calum Meikle Date: Mon, 10 Feb 2025 12:30:24 +0100 Subject: [PATCH 3/3] Updating gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 251345d8..9faf17c8 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ __pycache__ /mapies.egg-info/ /build/ run/run-nord3.sh +run/run_viirs.py grids/__pycache__ util/__pycache__ tests/__pycache__ -- GitLab