diff --git a/.gitignore b/.gitignore index 9faf17c84cc1f7be0f6a94ce28803cfd405ea9f0..7cef2fe677cbb692ccdc3f80e41f172c660f883c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,8 @@ outputs __pycache__ /mapies.egg-info/ /build/ -run/run-nord3.sh run/run_viirs.py +run/run_tropomi.py grids/__pycache__ util/__pycache__ tests/__pycache__ diff --git a/CHANGELOG b/CHANGELOG index 74ed4172dcb29a5c80ced82920839bf4f290b75c..07782405075826eaf7ce3fb0b5138670081b12ce 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,11 @@ CHANGELOG +## 0.1.2 -2025/03/07 - BUG time in netcdf outputs + +BUG FIX + +### Features +- Outputted time was incorrect in the netcdfs with some viirs data saying 21931, this has been fixed ## 0.1.1 - 2025/02/28 - Code refactoring diff --git a/mapies/config/satellite_config.yaml b/mapies/config/satellite_config.yaml index 36ef5e04732b6184eeea08320309e1a193b31631..f2d04bb39dadf130d3fd6c19cd6f2d88d62dffa9 100644 --- a/mapies/config/satellite_config.yaml +++ b/mapies/config/satellite_config.yaml @@ -56,4 +56,25 @@ grids: dlat: 0.1 #nlon: 3600 #nlat: 1800 + cams: + centre_lat: 35 + centre_lon: 15 + west: -35 + south: -27 + dlon: 0.2 + dlat: 0.2 + bdrc: + centre_lat: 35 + centre_lon: 20 + west: -51 + south: -35 + dlon: 0.1 + dlat: 0.1 + global: + west: -180 + south: -90 + dlon: 0.1 + dlat: 0.1 + #nlon: 3600 + #nlat: 1800 diff --git a/mapies/mapies.py b/mapies/mapies.py index 0b4577689f59710a070ddc3e7e84359e68f5d406..222d6095106aa5c6832c03498e29ee3220c7a27b 100644 --- a/mapies/mapies.py +++ b/mapies/mapies.py @@ -48,7 +48,8 @@ class MAPIES: "regular":RegularGrid, "ireg_rotated":IrregularRotatedGrid, "cams":CAMSGrid, - "bdrc":BDRCGrid + "bdrc":BDRCGrid, + "global":RegularGrid } @@ -363,14 +364,15 @@ class MAPIES: # Convert time to seconds since TIME_ORIGIN final_time_seconds = (time - self.time_orig) / np.timedelta64(1, "s") final_time_seconds = np.round(final_time_seconds, 0) - + grid_representation_str = json.dumps(self.grid_config, ensure_ascii=False) qa_flags_str = json.dumps(self.qualityFlags, ensure_ascii=False) + # Create xarray Dataset ds = xr.Dataset( coords={"time": ("time", final_time_seconds, { - "units": "seconds since 1900-01-01 00:00:00", + "units": f"seconds since {self.time_orig}", "calendar": "gregorian" })}, diff --git a/mapies/tropomi.py b/mapies/tropomi.py index 180649c80a6d48eb508f5c2e6b0f3d14ca55fccb..fe13be38b7b134c8d1b1d8bfb3e94980923d01d3 100644 --- a/mapies/tropomi.py +++ b/mapies/tropomi.py @@ -31,7 +31,7 @@ class TROPOMI(MAPIES): """ super().__init__(start_date, end_date) - self.time_orig = np.datetime64("1900-01-01T00:00:00") + self.time_orig = np.datetime64("1993-01-01T00:00:00") self.dest = kwargs.get("dest") if not os.path.exists(self.dest): raise Exception("Output directory doesn't exist") diff --git a/run/run_tropomi.py b/run/run_tropomi.py index fd74d50ee01a016b8def005fdf99292e9f3d1e8d..c9bdf577569d3f748331f950ab5ca15f06802a95 100644 --- a/run/run_tropomi.py +++ b/run/run_tropomi.py @@ -12,13 +12,13 @@ if __name__ == "__main__": start_time = time.time() - c = TROPOMI(start_date, end_date, dest=outdir, indir=indir, grid_repr="bdrc") + c = TROPOMI(start_date, end_date, dest=outdir, indir=indir, grid_repr="global") c.gather_nc_files() - c.process_avg_data(monthly_avg=False, batch_size = 14, apply_qa=True, geospatial_crop=[[-40, 60], [0, 70]]) + c.process_avg_data(monthly_avg=False, batch_size = 14, apply_qa=True, geospatial_crop=[[-40, 60], [0, 70]], save=True) c.plot_2D_observations(months=[0], outdir=outdir) c.plot_2D_num_obs(months=[0], outdir=outdir) - c.process_lazy_data(apply_qa=True, geospatial_crop=[[-40, 60], [0, 70]]) + #c.process_lazy_data(apply_qa=True, geospatial_crop=[[-40, 60], [0, 70]]) end_time = time.time() elapsed_time = end_time - start_time print(f"Script executed in {elapsed_time:.2f} seconds.") diff --git a/run/run_viirs.py b/run/run_viirs.py index d4ced0cd7adce443dbee19923ef0af653636763a..fe1a2fee8b11f07fbefefc215a18db3b3a1ad8e1 100644 --- a/run/run_viirs.py +++ b/run/run_viirs.py @@ -23,10 +23,10 @@ if __name__ == "__main__": c.gather_nc_files() - c.process_avg_data(monthly_avg=True, batch_size = 100, apply_qa=True, save=True) - c.yearly_average() - c.plot_2D_observations(months=None, filename="new.png", outdir=outdir) - c.plot_2D_num_obs(months=None, outdir=outdir) + c.process_avg_data(monthly_avg=False, batch_size = 100, apply_qa=True, save=True) + #c.yearly_average() + c.plot_2D_observations(months=[0], filename="new.png", outdir=outdir) + c.plot_2D_num_obs(months=[0], outdir=outdir) c.process_lazy_data(apply_qa=True, save=False) c.to_da(frequency="3H", save_figs=True) diff --git a/setup.py b/setup.py index de6cc56e769d8c73dd27f8ad8af779cee12fa055..18fbe5e7a395289e0c9ac88198b1bdb8b2f73bd1 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import find_packages from setuptools import setup # Could update this using versioneer -version="0.1.1" +version="0.1.2" setup( name="mapies",