Skip to content
Snippets Groups Projects
Commit a4080249 authored by Ian Boyd's avatar Ian Boyd
Browse files

Replace geoms_qa.pro

parent 8433a851
No related branches found
No related tags found
No related merge requests found
......@@ -60,6 +60,10 @@
; 2019-05-14, v1.68 Ian Boyd update due to fix in idlcr8ascii
; 2019-08-07, v1.69 Ian Boyd update due to modifications to idlcr8ascii and idlcr8hdf
; 2019-08-21, v1.70 Ian Boyd update due to fix in idlcr8ascii
; 2019-12-05, v2.00 Ian Boyd Add support for checks on the optional DATA_SOURCE Version Name value
; (third field in DATA_SOURCE). Calls new geoms_vntools function (similar
; in concept to geoms_tctools)
; 2020-02-26, v2.01 Ian Boyd update due to geoms_vntools updates
;---------------------------------------------------------------------------------------------------
PRO geoms_qa
......@@ -67,10 +71,12 @@ PRO geoms_qa
args = command_line_args()
iNrArgs = size(args, /N_ELEMENTS)
qaver='version 2.01, 2020-02-26'
if ( iNrArgs lt 2 ) then begin
print
print, 'GEOMS quality assurance (geoms_qa)'
print, ' Release v1.70, 2019-08-21'
print, ' Release '+qaver
print, ' Does GEOMS quality assurance on HDF4/5 and netCDF files.'
print
print, 'usage: idl -rt=geoms_qa.sav -args [TAVFILE] [[GEOMSTEFILE]] [ORIGFILE]'
......@@ -109,11 +115,12 @@ PRO geoms_qa
chFileOrig = STRTRIM( args( 2 ), 2 )
end
QA_error_code = 3
TC_error_code = 1
QA_error_code = 3 ;default QA error code
TC_error_code = 1 ;default TC error code
TC_error_code_2 = 1 ;default VN error code
if ( file_test( chFileTAV ) eq 0 ) then begin
QA_error_code = 3
QA_error_code = 2 ;can still do template checks if HDF and template files are present
print, 'ERROR: TAV file not found.'
end else begin
QA_error_code = 0
......@@ -121,20 +128,20 @@ PRO geoms_qa
if ( file_test( chFileOrig ) eq 0 ) then begin
QA_error_code = 3
print, 'ERROR: HDF file not found.'
print, 'ERROR: GEOMS file not found.'
end else begin
QA_error_code = 0
if QA_error_code ne 2 then QA_error_code = 0
end
if ( iNrArgs eq 3 ) then begin
if ( file_test( chFileGEOMSTE ) eq 0 ) then begin
QA_error_code = 3
print, 'ERROR: GEOMS-TE file not found.'
end else begin
QA_error_code = 0
TC_error_code = 0
end
end
if ( iNrArgs eq 3 ) then begin
if ( file_test( chFileGEOMSTE ) eq 0 ) then begin
print, 'ERROR: GEOMS-TE file not found.'
end else begin
if QA_error_code ne 3 then TC_error_code = 0 ;i.e. HDF file exists
endelse
end
if QA_error_code ne 3 then TC_error_code_2 = 0 ;i.e. HDF file exists
if ( QA_error_code eq 0 ) then begin
print, chFileTAV
......@@ -145,14 +152,56 @@ PRO geoms_qa
end else begin
QA_error_code = geoms_tools( 0, chFileTAV, chFileOrig )
end
end
endif else if (TC_error_code eq 0) or (TC_error_code_2 eq 0) then begin
;can't do QA but can do Template and/or Version Name checks so create logfile
logfile=STRMID(chFileOrig,0,STRPOS(chFileOrig,'.',/REVERSE_SEARCH))+'.log'
OPENW, lu, logfile, /GET_LUN
PRINTF,lu, 'geoms_tools '+qaver
PRINTF,lu,'GEOMS Quality Assurance Tool'
PRINTF,lu,'Maintained by the Aura Validation Data Center, NASA/GSFC'
PRINTF,lu,'http://avdc.gsfc.nasa.gov/GEOMS'
PRINTF,lu,''
PRINTF,lu,'Log started on '+SYSTIME(0)
PRINTF,lu,'Result of performing Quality Assurance on '+chFileOrig
PRINTF,lu,'(0=PASS, 1=GEOMS compliant with non-standard components, 2=FAIL)'
PRINTF,lu,''
PRINTF,lu,'ERROR: TAV file not found'
IF iNrArgs eq 3 then $
printf,lu,'INFORMATION: Required Metadata Template: '+File_Basename(chFileGEOMSTE)
PRINTF,lu,''
PRINTF,lu,'2 (Failed QA)'
Free_Lun, lu
endif
;Determine working directory for the version names list file
;First try the template directory, but otherwise use the TAV file directory
if iNrArgs eq 3 then chDirGEOMSvn = FILE_DIRNAME(chFileGEOMSTE, /Mark_Directory) $
else if iNrArgs eq 2 then chDirGEOMSvn = FILE_DIRNAME(chFileTAV, /Mark_Directory) $
else chDirGEOMSvn = '' ;can't find directory holding the version names list file
if ( TC_error_code eq 0 ) then begin
TC_error_code = geoms_tctools( chFileGEOMSTE, chFileOrig, QA_error_code )
TC_error_code = TC_error_code*3 + 4
end else begin
TC_error_code = 0
end
TC_error_code_hold = TC_error_code*3 + 4
endif else if (iNrArgs eq 3) and (QA_error_code ne 3) then begin
logfile=STRMID(chFileOrig,0,STRPOS(chFileOrig,'.',/REVERSE_SEARCH))+'.log'
OPENW, lu, logfile, /GET_LUN, /Append
printf, lu, ''
printf, lu, 'ERROR: GEOMS Metadata Template file not found'
Free_Lun, lu
QA_error_code = 3
TC_error_code = 0 & TC_error_code_hold = 0
endif else begin
TC_error_code = 0 & TC_error_code_hold = 0
endelse
if TC_error_code_2 eq 0 then begin
TC_error_code_2 = geoms_vntools( chDirGEOMSvn, chFileOrig, QA_error_code, TC_error_code )
;Note TC_error_code_2 will return the highest of TC_error_code or the Version Name error check value
if (TC_error_code_2 eq -1) or (QA_error_code eq 3) then begin
;File input error as data_version_name list file can't be found and there is a version name in the GEOMS file
TC_error_code = 0 & QA_error_code = 3
endif else TC_error_code = TC_error_code_2*3 + 4
endif else TC_error_code = TC_error_code_hold
; total error
QATC_error_code = QA_error_code + TC_error_code
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment