Commit 46f7f0c1 authored by Ian Boyd's avatar Ian Boyd

Replace idlcr8hdf.pro

parent dab9306c
;Main Program Version: idlcr8hdf.pro v4.0b50, 20190506
;Main Program Version: idlcr8hdf.pro v4.0b51, 20190807
; Written by Ian Boyd for the AVDC - iboyd@astro.umass.edu
;
;Sub-versions (refer to idlcr8hdf-v4.0_Readme.pdf for full history)
......@@ -113,7 +113,7 @@ PRO intro, intype
COMMON WIDGET_WIN
nhdr=44 & errtxt=STRARR(nhdr)
vertxt=['idlcr8hdf-v4.0_Readme.pdf','v4.0b49 December 2018']
vertxt=['idlcr8hdf-v4.0_Readme.pdf','v4.0b51 August 2019']
errtxt[1]='Welcome to IDLcr8HDF. This program creates GEOMS compliant HDF4, HDF5 and netCDF files'
errtxt[2]='(also refer to '+vertxt[0]+').'
errtxt[4]='Inputs to the program (IDL Virtual Machine (VM) and IDL Licensed (LIC) Versions):'
......@@ -142,9 +142,9 @@ errtxt[28]=' prompt for input if TAVFILE or OUTDIR are not included).'
errtxt[29]=' /H5, /Cn, /NC, /AVK, /Log and /Popup keywords are used in place of the options given below (HDF4 is default).'
errtxt[30]='The /Cn keyword enables compression and shuffling of HDF5 files only (C1=low, C9=high). Default is no compression.'
errtxt[32]='Contacts -'
errtxt[33]=' Ian Boyd (iboyd@astro.umass.edu)'
errtxt[34]=' BC Scientific Consulting'
errtxt[35]=' 6 University Drive, Ste 206-135, Amherst, MA 01002, USA'
errtxt[33]=' Ian Boyd, BC Scientific Consulting LLC (iboyd@astro.umass.edu)'
errtxt[34]=' 26 Campbells Rd'
errtxt[35]=' Pine Hill, Dunedin 9010, New Zealand'
errtxt[37]=' Ann Mari Fjaeraa, EVDC Project Manager (amf@nilu.no)'
errtxt[38]=' Norwegian Institute for Air Research, Instituttveien 18'
errtxt[39]=' Postbox 100, N-2027 KJELLER, NORWAY'
......@@ -4851,10 +4851,13 @@ PRO find_hdf_filename, hdffilename
; 20180314: Fix bug when checking DATA_START|STOP_DATE values. Criteria for difference with
; MJD2K values change to GT 0.99d/86400.d instead of GE 1.0d/86400.d -
; Version 4.0b46
; 20190807: Allow .nc and .nc4 filename extensions when doing QA on a file that has been read
; into session memory using the HDF5 routines (idlcr8ascii set up to use H5 routines
; to read netCDF4 files as well as HDF5) - Version 4.0b51
;
; Inputs: meta_arr - a string array containing the Global and Variable Attributes
; hfdfilename - a string holding the extension of the eventual HDF filename, either
; '.hdf' for HDF4 or '.h5' for HDF5
; '.hdf' for HDF4 or '.h5' for HDF5 or '.nc' for netCDF3/4
;
; Outputs: meta_arr - DATA_START_DATE, FILE_GENERATION_DATE and FILE_NAME values will be
; (re)written to the array based on values computed by the routine
......@@ -4888,6 +4891,20 @@ errtxt[1]=' should be '
errtxt[2]=' ISO8601 format not valid: '
errtxt[3]='Type conversion error. MJD2K entry is not valid: '
ai=WHERE(attr_arr_glob EQ 'FILE_NAME')
res=STRSPLIT(meta_arr[ai[0]],' =',/Extract)
IF N_ELEMENTS(res) EQ 1 THEN res=[res,'-1']
fn_val=res[1]
IF (qa_yes) AND (hdffilename EQ '.h5') AND (fn_val NE '-1') THEN BEGIN
;netCDF4 files read in using H5 routines so .h5 extension is assumed. Allow files to
;also have .nc or .nc4 extensions for files being QA'd
hext=['.h5','.nc','.nc4']
fn_ext=STRMID(fn_val,STRPOS(fn_val,'.',/REVERSE_SEARCH))
ei=WHERE(fn_ext EQ hext,ecnt)
IF ecnt NE 0 THEN hdffilename=hext[ei[0]]
ENDIF
fhold='' & iso='' & mjd2000=0.d
dtmjd=0.d & dtiso='' & itxt=' '
dt=['DISCIPLINE','SOURCE','LOCATION','START_DATE','STOP_DATE','FILE_GENERATION_DATE','FILE_VERSION']
......@@ -5022,16 +5039,14 @@ FOR i=0,N_ELEMENTS(dt)-1 DO BEGIN
ENDIF
ENDFOR
hdffilename=fhold+hdffilename
;check to see if the resulting filename is the same as that under FILE_NAME
ai=WHERE(attr_arr_glob EQ 'FILE_NAME')
res=STRSPLIT(meta_arr[ai[0]],' =',/Extract)
IF N_ELEMENTS(res) EQ 1 THEN res=[res,'-1']
IF hdffilename NE res[1] THEN BEGIN
IF res[1] NE '-1' THEN BEGIN
IF hdffilename NE fn_val THEN BEGIN
IF fn_val NE '-1' THEN BEGIN
infotxt=STRARR(3)
infotxt[0]='2 FILE_NAME entry under File Attributes does not match the filename'
infotxt[0]=infotxt[0]+' determined from the Global Attributes'
infotxt[1]=' '+res[1]+' -> '+hdffilename+'|'
infotxt[1]=' '+fn_val+' -> '+hdffilename+'|'
infotxt[2]=' Filename determined from Global Attributes used'
ENDIF ELSE BEGIN
IF qa_yes THEN qtxt='should be '+hdffilename ELSE qtxt=hdffilename+' added'
......@@ -5040,7 +5055,7 @@ IF hdffilename NE res[1] THEN BEGIN
infotxt[1]=' based on Global Attribute values'
ENDELSE
INFOTXT_OUTPUT, infotxt
meta_arr[ai[0]]=res[0]+'='+hdffilename ;change FILE_NAME entry
meta_arr[ai[0]]='FILE_NAME='+hdffilename ;change FILE_NAME entry
ENDIF
valid=1 ;Type conversions performed OK
......@@ -5768,7 +5783,7 @@ PRO idlcr8hdf, ga, sds, tav, odir, reterr, H5=o1, AVK=o2, LOG=o4, POPUP=o5, QA=o
;
;Program documentation, idlcr8hdf-v4.0_Readme.pdf, available from http://avdc.gsfc.nasa.gov.
;
;Program sub-version 4.0b50 (20190506)
;Program sub-version 4.0b51 (20190807)
; ----------
;Written by Ian Boyd for the AVDC - iboyd@astro.umass.edu
;
......
Markdown is supported
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