diff --git a/.gitignore b/.gitignore index 251345d8c55b5564b0345b3fc0b48dbf25477a19..9faf17c84cc1f7be0f6a94ce28803cfd405ea9f0 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__ diff --git a/mapies/viirs.py b/mapies/viirs.py index e8d3aa83d5c09e7714a7470591d4fd18cf9e949a..437de267b5e16c1ea0865417d2e0a9945f442c57 100644 --- a/mapies/viirs.py +++ b/mapies/viirs.py @@ -258,11 +258,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}') @@ -281,10 +282,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 a3adc1536d6a25a55f1017b6d01b16292d2dce94..dfc2bc35b595b924db23d927832c5763de636c1e 100644 --- a/run/run_viirs.py +++ b/run/run_viirs.py @@ -6,32 +6,17 @@ 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" - - # 00:30 to 16:36 of 2024-01-01 start_date = "202401010030" - end_date = "202401011636" - - # ONE YEAR - # start_date = "202401300000" - # end_date = "202412312359" - # end_date = "202402022359" - - # ONE MONTH - JANUARY 2024 - # start_date = "202401010000" - # end_date = "202401312359" + end_date = "202401030236" + filename_obs = '1month_obs.png' + filename_num_obs = '1month_num_obs.png' - 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" - filename_obs = 'carlotta' - filename_num_obs = 'carlotta' + start_time = time.time()