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 = "202401030236"



    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=False, geospatial_crop=[[0, 20], [10, 20]])
    # c.yearly_average()
    c.plot_2D_observations(months=[0], filename="Viirs_qa_not_applied.png", outdir=outdir)
    c.plot_2D_num_obs(months=[0], filename="Viirs_num_obsqa_not_applied.png", 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.")


