from mapies.viirs import VIIRS
import time
# from dask.distributed import Client


if __name__ == "__main__":
    # Change these variables
    # 00:30 to 02:36 from 2024-01-01 to 2024-01-03
    start_date = "202401010030"
    end_date = "202401022359"



    outdir="/home/cmeikle/Projects/data/"
    indir="/home/cmeikle/Projects/data/VIIRS"


    start_time = time.time()

    c = VIIRS(start_date, end_date, dest=outdir, indir=indir, grid_repr="rotated")
    c.read_nc()


    c.process_data(monthly_avg=False, batch_size = 50, apply_qa=True, save=True)
    # c.yearly_average()
    c.plot_2D_observations(months=[0], 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)
    

    
    end_time = time.time()
    elapsed_time = end_time - start_time
    print(f"Script executed in {elapsed_time:.2f} seconds.")


