-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DDAI-7: Add script to produce total column water
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-- Produce total column water for MEPS / MNWC | ||
-- "This parameter is the sum of water vapour, liquid water, cloud ice, | ||
-- rain and snow in a column extending from the surface of the Earth to | ||
-- the top of the atmosphere." | ||
-- Source: https://codes.ecmwf.int/grib/param-db/136 | ||
|
||
local tcwv = luatool:Fetch(current_time, level(HPLevelType.kEntireAtmosphere, 0), param("TOTCWV-KGM2"), current_forecast_type) | ||
local cldice = hitool:VerticalSum(param("CLDICE-KGKG"),8,15000) | ||
local cldwtr = hitool:VerticalSum(param("CLDWAT-KGKG"),8,15000) | ||
local snowmr = hitool:VerticalSum(param("SNOWMR-KGKG"),8,15000) | ||
local rainmr = hitool:VerticalSum(param("RAINMR-KGKG"),8,15000) | ||
local graupmr = hitool:VerticalSum(param("GRAUPMR-KGKG"),8,15000) | ||
|
||
if not tcwv or not cldice or not cldwtr or not snowmr or not rainmr or not graupmr then | ||
logger:Error("Data not found") | ||
return | ||
end | ||
|
||
local tcw = {} | ||
for i=1, #tcwv do | ||
tcw[i] = tcwv[i] + cldice[i] + cldwtr[i] + snowmr[i] + rainmr[i] + graupmr[i] | ||
end | ||
|
||
result:SetParam(param("TCW-KGM2")) | ||
result:SetValues(tcw) | ||
luatool:WriteToFile(result) |