<commit_before>-- Calculating low and middle clouds parameter 
--
-- This script will replace qdversionfilter; the parameter is very
-- rudimentary and should not be used in any new products

logger:Info("Calculating low and middle clouds")

local MISS = missing

local N = luatool:Fetch(current_time, current_level, param("N-PRCNT")) -- total cloudiness
local NL = luatool:Fetch(current_time, current_level, param("NL-PRCNT")) -- low clouds
local NM = luatool:Fetch(current_time, current_level, param("NM-PRCNT")) -- middle clouds
local NH = luatool:Fetch(current_time, current_level, param("NH-PRCNT")) -- high clouds

if not N or not NL or not NM or not NH then
  return
end

local NLM = {} -- low and middle clouds

for i=1,#N do
  local n = N[i]
  local nl = NL[i]
  local nm = NM[i]
  local nh = NH[i]

  local nlm = MISS

  if nh == 0 or IsMissing(nh) then
    if IsValid(n) then
      nlm = n
    end
  else
    if IsValid(nl) then
      if IsValid(nm) then
        nlm = math.max(nl, nm)
      else
        nlm = nl
      end
    else
      if IsValid(nm) then
        nlm = nm
      end  
    end
  end  

  NLM[i] = nlm
end

result:SetParam(param("NLM-PRCNT"))
result:SetValues(NLM)
luatool:WriteToFile(result)<commit_msg>Try fetching clouds X-0TO1 if X-PRCNT fails<commit_after>-- Calculating low and middle clouds parameter 
--
-- This script will replace qdversionfilter; the parameter is very
-- rudimentary and should not be used in any new products

logger:Info("Calculating low and middle clouds")

local MISS = missing

local N = luatool:Fetch(current_time, current_level, param("N-PRCNT")) -- total cloudiness
local NL = luatool:Fetch(current_time, current_level, param("NL-PRCNT")) -- low clouds
local NM = luatool:Fetch(current_time, current_level, param("NM-PRCNT")) -- middle clouds
local NH = luatool:Fetch(current_time, current_level, param("NH-PRCNT")) -- high clouds

local scale = 1

if not N or not NL or not NM or not NH then
  N = luatool:Fetch(current_time, current_level, param("N-0TO1")) -- total cloudiness
  NL = luatool:Fetch(current_time, current_level, param("NL-0TO1")) -- low clouds
  NM = luatool:Fetch(current_time, current_level, param("NM-0TO1")) -- middle clouds
  NH = luatool:Fetch(current_time, current_level, param("NH-0TO1")) -- high clouds

  if not N or not NL or not NM or not NH then
    return
  end

  scale = 100
end

local NLM = {} -- low and middle clouds

for i=1,#N do
  local n = N[i]
  local nl = NL[i]
  local nm = NM[i]
  local nh = NH[i]

  local nlm = MISS

  if nh == 0 or IsMissing(nh) then
    if IsValid(n) then
      nlm = n
    end
  else
    if IsValid(nl) then
      if IsValid(nm) then
        nlm = math.max(nl, nm)
      else
        nlm = nl
      end
    else
      if IsValid(nm) then
        nlm = nm
      end  
    end
  end  

  NLM[i] = nlm * scale
end

result:SetParam(param("NLM-PRCNT"))
result:SetValues(NLM)
luatool:WriteToFile(result)
{'fraction_non_alphanumeric': 0.10693542876665528, 'fraction_numerical': 0.0061496412709258624, 'mean_word_length': 3.1414427157001414, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5614812', 'n_tokens_mistral': 1065, 'n_tokens_neox': 997, 'n_words': 333}