#!/bin/bash 
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

datai=2022120100
dataf=2023030100
scr=/share/ioper/tempo/MERGE/GOES/OBS 
out=/share/ioper/tempo/MERGE/GOES/OBS/BDM_OPER 

while [ ${datai} -le ${dataf} ]; do
 echo $datai
 mkdir -p $out/${datai:0:6}
 cd $out/${datai:0:6}
 /oper/bdados/user/retrieve  --h  --i ${datai}  --f ${datai}  --o T_${datai}_tmp.txt
 cat T_${datai}_tmp.txt |grep -v -E "code" |awk '{if ($13>=0.0) print $1" BDM_OPER "$16"  "$2"  "$3"  "$13}'  > PREC_BDM_${datai}.txt
 rm -f T_${datai}_tmp.txt
 datai=`date -d "${datai:0:8} ${datai:8:10}:00 1 hours" +"%Y%m%d%H"`
done


datai=2023120100
dataf=2024030100
scr=/share/ioper/tempo/MERGE/GOES/OBS 
out=/share/ioper/tempo/MERGE/GOES/OBS/BDM_OPER 

while [ ${datai} -le ${dataf} ]; do
 echo $datai
 mkdir -p $out/${datai:0:6}
 cd $out/${datai:0:6}
 /oper/bdados/user/retrieve  --h  --i ${datai}  --f ${datai}  --o T_${datai}_tmp.txt
 cat T_${datai}_tmp.txt |grep -v -E "code" |awk '{if ($13>=0.0) print $1" BDM_OPER "$16"  "$2"  "$3"  "$13}'  > PREC_BDM_${datai}.txt
 rm -f T_${datai}_tmp.txt
 datai=`date -d "${datai:0:8} ${datai:8:10}:00 1 hours" +"%Y%m%d%H"`
done



datai=2024120100
dataf=2025030100
scr=/share/ioper/tempo/MERGE/GOES/OBS 
out=/share/ioper/tempo/MERGE/GOES/OBS/BDM_OPER 

while [ ${datai} -le ${dataf} ]; do
 echo $datai
 mkdir -p $out/${datai:0:6}
 cd $out/${datai:0:6}
 /oper/bdados/user/retrieve  --h  --i ${datai}  --f ${datai}  --o T_${datai}_tmp.txt
 cat T_${datai}_tmp.txt |grep -v -E "code" |awk '{if ($13>=0.0) print $1" BDM_OPER "$16"  "$2"  "$3"  "$13}'  > PREC_BDM_${datai}.txt
 rm -f T_${datai}_tmp.txt
 datai=`date -d "${datai:0:8} ${datai:8:10}:00 1 hours" +"%Y%m%d%H"`
done



