
from functions_enandes import *

stac_tile = '012010'
stac_collection = 'mod13q1-6.1'
stac_date_range = '2001-01-01/2001-01-31' 
stac_asset_reference_key = 'NDVI'
# input_pkl_file = '/home/jovyan/Desktop/enandes_v2/tile012010/resultmax.pkl'
# output_cog_file = '/home/jovyan/Desktop/enandes_v2/tile012010/resultmax.tif'

input_pkl_file = '/home/jovyan/Desktop/enandes_v2/modelo_produtividade/dados_ndvi_pkl/ndvi_2021.pkl'
output_cog_file = '/home/jovyan/Desktop/enandes_v2/modelo_produtividade/dados_ndvi_pkl/ndvi_2021.tif'

num_bands_in_pkl = 23 # 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_with_stac_ref(
    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,
    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
)

