From 7661377c5c157e7e01c7c278cbf43e40a86b5557 Mon Sep 17 00:00:00 2001 From: tackandr Date: Fri, 1 Nov 2024 11:30:55 +0200 Subject: [PATCH] Add filters to EC and ICON, add thresholds for CB/TCU flight levels --- himan-scripts/CB-TCU-cloud.lua | 80 ++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/himan-scripts/CB-TCU-cloud.lua b/himan-scripts/CB-TCU-cloud.lua index 3db369ad..993a2a6b 100644 --- a/himan-scripts/CB-TCU-cloud.lua +++ b/himan-scripts/CB-TCU-cloud.lua @@ -80,56 +80,58 @@ if not NL or not NM or not RR then return end -if currentProducerName == "MEPS" or currentProducerName == "MEPSMTA" then - local Nmat = matrixf(result:GetGrid():GetNi(), result:GetGrid():GetNj(), 1, 0) - Nmat:SetValues(EL500) - EL500 = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +if currentProducerName ~= "MEPS" and currentProducerName ~= "MEPSMTA" then + filter = matrixf(9, 9, 1, 1.0) +end - Nmat:SetValues(pEL500) - pEL500 = Min2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - - Nmat:SetValues(ELmu) - ELmu = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - - Nmat:SetValues(pELmu) - pELmu = Min2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +local Nmat = matrixf(result:GetGrid():GetNi(), result:GetGrid():GetNj(), 1, 0) +Nmat:SetValues(EL500) +EL500 = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - Nmat:SetValues(RR) - RR = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +Nmat:SetValues(pEL500) +pEL500 = Min2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - Nmat:SetValues(NL) - NL = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +Nmat:SetValues(ELmu) +ELmu = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - Nmat:SetValues(NM) - NM = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +Nmat:SetValues(pELmu) +pELmu = Min2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - Nmat:SetValues(Ttop) - Ttop = Min2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +Nmat:SetValues(RR) +RR = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - Nmat:SetValues(TtopMU) - TtopMU = Min2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +Nmat:SetValues(NL) +NL = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - Nmat:SetValues(LCL500) - LCL500 = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +Nmat:SetValues(NM) +NM = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - Nmat:SetValues(CAPE500) - CAPE500 = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +Nmat:SetValues(Ttop) +Ttop = Min2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - Nmat:SetValues(CIN500) - CIN500 = Min2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +Nmat:SetValues(TtopMU) +TtopMU = Min2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - Nmat:SetValues(LFCmu) - LFCmu = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +Nmat:SetValues(LCL500) +LCL500 = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - Nmat:SetValues(pLFCmu) - pLFCmu = Min2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +Nmat:SetValues(CAPE500) +CAPE500 = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - Nmat:SetValues(CAPEmu) - CAPEmu = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() +Nmat:SetValues(CIN500) +CIN500 = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() - Nmat:SetValues(CINmu) - CINmu = Min2D(Nmat,filter,configuration:GetUseCuda()):GetValues() -end +Nmat:SetValues(LFCmu) +LFCmu = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() + +Nmat:SetValues(pLFCmu) +pLFCmu = Min2D(Nmat,filter,configuration:GetUseCuda()):GetValues() + +Nmat:SetValues(CAPEmu) +CAPEmu = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() + +Nmat:SetValues(CINmu) +CINmu = Max2D(Nmat,filter,configuration:GetUseCuda()):GetValues() local CBlimit = 2000 --required vertical thickness [m] to consider a CB (tweak this..!) local TCUlimit = 1500 --required vertical thickness [m] to consider a TCU (tweak this..!) @@ -194,6 +196,10 @@ for i=1, #EL500 do end res[i] = round(res[i]/10)*10 + --Threshold flight level for TCU above FL70 and CB above FL80 + if res[i] < 80 and res[i] > -70 then + res[i] = missing + end end p = param("CBTCU-FL")