from mapies.tropomi import TROPOMI
import numpy as np
import time
# from dask.distributed import Client


if __name__ == "__main__":
    start_date = "202212010000"
    end_date = "202212202359"

    outdir = "/esarchive/scratch/cmeikle/"
    indir = "/esarchive/obs/sentinel/tropomi/original_files/tropomi_OFFL_NO2"

    start_time = time.time()

    c = TROPOMI(start_date, end_date, dest=outdir, indir=indir, apply_qa=True, grid_repr="rotated")
    c.read_nc()
    c.process_data(monthly_avg=True, batch_size = 13)

    # c.yearly_average()
    c.plot_2D_observations(months=[12], outdir=outdir)
    c.plot_2D_num_obs(months=[12], outdir=outdir)
    #c.process_lazy_data()
    end_time = time.time()
    elapsed_time = end_time - start_time
    print(f"Script executed in {elapsed_time:.2f} seconds.")
