
from functions_enandes import *

stac_tile = '013011'
stac_collection = 'mod13q1-6.1'
stac_date_range = '2001-01-01/2001-01-31' 
stac_asset_reference_key = 'NDVI'

for years in range(2001,2025):
    for loop_time in range(0,23):
        input_pkl_file = f'/home/jovyan/Desktop/enandes_v2/tile_enviar_FATEC/tile013011/filtered_{years}.pkl'
        output_cog_file = f'/home/jovyan/Desktop/enandes_v2/tile_enviar_FATEC/tile013011/filtered_{loop_time}_{years}.tif'
    
        num_bands_in_pkl = 1 # Se seu resultAve.pkl tiver múltiplas bandas, ajuste aqui # 23 para stats
        dtype_in_pkl = 'float32' # Ajuste conforme o tipo de dado no seu pkl
        pkl_height, pkl_width = 4800, 4800 
        pkl_to_cog_filtered(
            pkl_path=input_pkl_file,
            output_cog_path=output_cog_file,
            stac_tile_id=stac_tile,
            stac_collection_id=stac_collection,
            stac_datetime_range=stac_date_range,
            time_to_select=loop_time,
            stac_asset_key=stac_asset_reference_key,
            num_bands_pkl=num_bands_in_pkl, # Importante: corresponder ao conteúdo do seu pkl
            dtype_pkl=dtype_in_pkl,         # Importante: corresponder ao conteúdo do seu pkl
            block_size=512,
            compression='LZW' # LZW também é uma boa opção
        )
        print(f"completed_{years}")

print(f"done")

