Commit 79304c89 authored by Ian Boyd's avatar Ian Boyd
Browse files

Replace geoms_vntools.pro

parent 8b70c3a2
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
; description: GEOMS data version name checker tool ; description: GEOMS data version name checker tool
; ;
; 2019-12-05, v2.00 Ian Boyd initial implementation (version aligned with geoms_qa) ; 2019-12-05, v2.00 Ian Boyd initial implementation (version aligned with geoms_qa)
; 2020-02-25, v2.01 Ian Boyd changes to align with version 2.3 of the Data Versioning Guidelines ; 2020-02-25, v2.01 Ian Boyd changes to align with version 2.3 of the Data Versioning Guidelines
; 2020-04-27, v2.02 Ian Boyd Allow DATA_SOURCE_01 inclusion/exclusion settings to cover more than
; one value - e.g. UVVIS.DOAS would mean the version name can be used
; in any file with UVVIS.DOAS as part of the DATA_SOURCE value
;--------------------------------------------------------------------------------------------------- ;---------------------------------------------------------------------------------------------------
FUNCTION is_a_number_vn,value FUNCTION is_a_number_vn,value
...@@ -107,7 +110,6 @@ END ...@@ -107,7 +110,6 @@ END
;--------------------------------------------------------------------------------------------------- ;---------------------------------------------------------------------------------------------------
FUNCTION incl_excl_checks, chvn_chk, chvn_excl_incl, n_chks, ga_chk_vals, lu FUNCTION incl_excl_checks, chvn_chk, chvn_excl_incl, n_chks, ga_chk_vals, lu
;Check against excluded (~) or included DATA_SOURCE_01, FILE_ACCESS, PI_NAME, AFFILIATION ;Check against excluded (~) or included DATA_SOURCE_01, FILE_ACCESS, PI_NAME, AFFILIATION
;(from DATA_SOURCE) and DATA_LOCATION values ;(from DATA_SOURCE) and DATA_LOCATION values
...@@ -122,12 +124,14 @@ FUNCTION incl_excl_checks, chvn_chk, chvn_excl_incl, n_chks, ga_chk_vals, lu ...@@ -122,12 +124,14 @@ FUNCTION incl_excl_checks, chvn_chk, chvn_excl_incl, n_chks, ga_chk_vals, lu
endif else begin endif else begin
for i = 1, n_chks-1 do begin for i = 1, n_chks-1 do begin
if chvn_chk[i] ne '' then begin if chvn_chk[i] ne '' then begin
;separate out into component values (separated by '|') ;separate out into component values (separated by '|' or '&')
ds_vals = strsplit(strupcase(chvn_chk[i]), '|', /EXTRACT, count=dscnt) ds_vals = strsplit(strupcase(chvn_chk[i]), '|&', /EXTRACT, count=dscnt)
ds_vals = strcompress(ds_vals,/Remove_All) ds_vals = strcompress(ds_vals,/Remove_All)
;separate inclusion and exclusion values
evi = where(strmid(ds_vals,0,1) eq '~', evcnt, complement = ivi, ncomplement = ivcnt)
if chvn_excl_incl[i] eq 'FILE_ACCESS' then begin if chvn_excl_incl[i] eq 'FILE_ACCESS' then begin
;can have multiple values ;can have multiple values in the GEOMS file
ga_fa_vals = strsplit(ga_chk_vals[i,0],' ;',/Extract, count=fa_cnt) ga_fa_vals = strsplit(ga_chk_vals[i,0],' ;',/Extract, count=fa_cnt)
ga_fa_vals = strcompress(ga_fa_vals,/Remove_All) ga_fa_vals = strcompress(ga_fa_vals,/Remove_All)
;1. need to check that all ga_fa_vals are in the 'included' list ;1. need to check that all ga_fa_vals are in the 'included' list
...@@ -154,27 +158,55 @@ FUNCTION incl_excl_checks, chvn_chk, chvn_excl_incl, n_chks, ga_chk_vals, lu ...@@ -154,27 +158,55 @@ FUNCTION incl_excl_checks, chvn_chk, chvn_excl_incl, n_chks, ga_chk_vals, lu
endelse endelse
printf, lu, chMessage printf, lu, chMessage
print, chMessage print, chMessage
endif else if chvn_excl_incl[i] eq 'DATA_SOURCE_01' then begin
;Allow ds_vals to include multiple DATA_SOURCE_01 options e.g. UVVIS.DOAS
;Won't pass if it fails an exclusion check
passcheck = 1B ;set default to DATA_SOURCE_01 value being OK
if evcnt ne 0 then begin
;check if file value is on the list of exclusions - if so then fails check
for j = 0, evcnt-1 do begin
if strpos( ga_chk_vals[i,0], strmid(ds_vals[evi[j]],1)) ne -1 then $
passcheck = 0B
endfor
endif
;Note: only need to do inclusion checks if it has passed, or there are no, exclusion checks
if (ivcnt ne 0) and (passcheck) then begin
;check if file value is on the list of inclusions - if not then fails check
passcheck = 0B ;set default to DATA_SOURCE_01 value not being OK
for j = 0, ivcnt-1 do begin
if strpos( ga_chk_vals[i,0], ds_vals[ivi[j]]) ne -1 then $
passcheck = 1B
endfor
endif
if ~passcheck then begin
chMessage = ' ERROR: '+ga_chk_vals[i,1]+' '+chvn_excl_incl[i]+ $
' value not permitted'
chMessage = chMessage+chtxtvn+chvn_chk[i]
ico = (-1)
endif else chMessage = ' INFORMATION: '+ga_chk_vals[i,1]+' '+ $
chvn_excl_incl[i]+' value permitted'
printf, lu, chMessage
print, chMessage
endif else begin endif else begin
;do checks on the rest of the ;do checks on the rest of the criteria
passcheck = (-1) ;default is that it does not pass the check ;Won't pass if it fails an exclusion check
changeallwd = 1B ;passcheck can change value passcheck = 1B ;set default to value being OK
for j = 0, dscnt-1 do begin if evcnt ne 0 then begin
if strmid(ds_vals[j],0,1) ne '~' then begin ;check if file value is on the list of exclusions - if so then fails check
;passes only if there is a match for j = 0, evcnt-1 do begin
if passcheck ne 1 then passcheck = 0 if ga_chk_vals[i,0] eq strmid(ds_vals[evi[j]],1) then passcheck = 0B
if (ga_chk_vals[i,0] eq ds_vals[j]) and (changeallwd) then begin endfor
passcheck = 1 & changeallwd = 0B endif
endif ;Note: only need to do inclusion checks if it has passed, or there are no, exclusion checks
endif else begin if (ivcnt ne 0) and (passcheck) then begin
;fails if there is a match ;check if file value is on the list of inclusions - if not then fails check
if passcheck ne 0 then passcheck = 1 passcheck = 0B ;set default to DATA_SOURCE_01 value not being OK
ds_vals[j] = strmid(ds_vals[j], 1) for j = 0, ivcnt-1 do begin
if (ga_chk_vals[i,0] eq ds_vals[j]) and (changeallwd) then begin if ga_chk_vals[i,0] eq ds_vals[ivi[j]] then passcheck = 1B
passcheck = 0 & changeallwd = 0B endfor
endif endif
endelse if ~passcheck then begin
endfor
if passcheck eq 0 then begin
chMessage = ' ERROR: '+ga_chk_vals[i,1]+' '+chvn_excl_incl[i]+ $ chMessage = ' ERROR: '+ga_chk_vals[i,1]+' '+chvn_excl_incl[i]+ $
' value not permitted' ' value not permitted'
chMessage = chMessage+chtxtvn+chvn_chk[i] chMessage = chMessage+chtxtvn+chvn_chk[i]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment