Commit 70310685 authored by Ian Boyd's avatar Ian Boyd
Browse files

Replace idlcr8hdf.pro

parent f162e1cd
;Main Program Version: idlcr8hdf.pro v4.0b58, 20201211 ;Main Program Version: idlcr8hdf.pro v4.0b59, 20210617
; Written by Ian Boyd for the EVDC/AVDC - iboyd@astro.umass.edu ; Written by Ian Boyd for the EVDC/AVDC - iboyd@astro.umass.edu
; ;
;Sub-versions (refer to idlcr8hdf-v4.0_Readme.pdf for full history) ;Sub-versions (refer to idlcr8hdf-v4.0_Readme.pdf for full history)
...@@ -113,7 +113,7 @@ PRO intro, intype ...@@ -113,7 +113,7 @@ PRO intro, intype
COMMON WIDGET_WIN COMMON WIDGET_WIN
nhdr=44 & errtxt=STRARR(nhdr) nhdr=44 & errtxt=STRARR(nhdr)
vertxt=['idlcr8hdf-v4.0_Readme.pdf','v4.0b58 December 2020'] vertxt=['idlcr8hdf-v4.0_Readme.pdf','v4.0b59 June 2021']
errtxt[1]='Welcome to IDLcr8HDF. This program creates GEOMS compliant HDF4, HDF5 and netCDF files' errtxt[1]='Welcome to IDLcr8HDF. This program creates GEOMS compliant HDF4, HDF5 and netCDF files'
errtxt[2]='(also refer to '+vertxt[0]+').' errtxt[2]='(also refer to '+vertxt[0]+').'
errtxt[4]='Inputs to the program (IDL Virtual Machine (VM) and IDL Licensed (LIC) Versions):' errtxt[4]='Inputs to the program (IDL Virtual Machine (VM) and IDL Licensed (LIC) Versions):'
...@@ -3527,6 +3527,8 @@ PRO set_up_structure, sds, inf ...@@ -3527,6 +3527,8 @@ PRO set_up_structure, sds, inf
; Version 4.0b40 ; Version 4.0b40
; 20180218: Change Unexpected number of attribute values extracted error message so that it calls ; 20180218: Change Unexpected number of attribute values extracted error message so that it calls
; INFOTXT_OUTPUT rather than STOP_WITH_ERROR - Version 4.0b45 ; INFOTXT_OUTPUT rather than STOP_WITH_ERROR - Version 4.0b45
; 20210617: Add section to do VAR_DATA_TYPE checks on the datasets, VAR_VALID_MIN, VAR_VALID_MAX and
; VAR_FILL_VALUE values, to ensure they are all matching - Version 4.0b59
; ;
; Inputs: sds - Either a structure containing the Variable Attributes and Data, or the input ; Inputs: sds - Either a structure containing the Variable Attributes and Data, or the input
; data file ; data file
...@@ -3573,6 +3575,8 @@ PRO set_up_structure, sds, inf ...@@ -3573,6 +3575,8 @@ PRO set_up_structure, sds, inf
; Information Conditions (when the program is able to make changes): ; Information Conditions (when the program is able to make changes):
; 1. 64-bit LONG Data Type is not currently supported in GEOMS. Will attempt to write data in 32-bit ; 1. 64-bit LONG Data Type is not currently supported in GEOMS. Will attempt to write data in 32-bit
; Integer type instead ; Integer type instead
; 2. Dataset/VAR_VALID_MIN/VAR_VALID_MAX/VAR_FILL_VALUE value(s) have data type that does not match
; VAR_DATA_TYPE
COMMON METADATA COMMON METADATA
COMMON DATA COMMON DATA
...@@ -3601,6 +3605,7 @@ proname='Set_Up_Structure procedure: ' ...@@ -3601,6 +3605,7 @@ proname='Set_Up_Structure procedure: '
lc=0 & vc=0 & writeonce=0 & bounderror=0 lc=0 & vc=0 & writeonce=0 & bounderror=0
allowable_data_types=['BYTE','SHORT','INTEGER','LONG','REAL','DOUBLE','STRING'] allowable_data_types=['BYTE','SHORT','INTEGER','LONG','REAL','DOUBLE','STRING']
idl_data_type=[1,2,3,14,4,5,7] ;IDL type identifiers matching allowable_data_types
num_atts=['VAR_VALID_MIN','VAR_VALID_MAX','VAR_FILL_VALUE'] num_atts=['VAR_VALID_MIN','VAR_VALID_MAX','VAR_FILL_VALUE']
nna=N_ELEMENTS(num_atts) nna=N_ELEMENTS(num_atts)
...@@ -3944,7 +3949,7 @@ WHILE lc LT N_ELEMENTS(meta_arr) DO BEGIN ...@@ -3944,7 +3949,7 @@ WHILE lc LT N_ELEMENTS(meta_arr) DO BEGIN
vfvd[i,vc]=mjd2000 vfvd[i,vc]=mjd2000
infotxt=STRARR(2) infotxt=STRARR(2)
meta_arr[lc]=resv[0]+'='+STRTRIM(STRING(format='(d18.9)',mjd2000),2) meta_arr[lc]=resv[0]+'='+STRTRIM(STRING(format='(d18.9)',mjd2000),2)
IF qa_yes THEN qtxt=' should be in MJD2K format|' ELSE qtxt=' replaced with MJD2K formatted value ' IF qa_yes THEN qtxt=' must be in MJD2K format|' ELSE qtxt=' replaced with MJD2K formatted value '
infotxt[0]='2 '+resv[0]+'='+resv[1]+' for VAR_NAME='+vn[vc] infotxt[0]='2 '+resv[0]+'='+resv[1]+' for VAR_NAME='+vn[vc]
infotxt[1]=qtxt+meta_arr[lc] infotxt[1]=qtxt+meta_arr[lc]
INFOTXT_OUTPUT,infotxt INFOTXT_OUTPUT,infotxt
...@@ -3973,6 +3978,65 @@ ENDIF ...@@ -3973,6 +3978,65 @@ ENDIF
;Save numeric metadata values to common arrays ;Save numeric metadata values to common arrays
mv_lng=vfvl & mv_dbl=vfvd mv_lng=vfvl & mv_dbl=vfvd
IF qa_yes THEN BEGIN
ON_IOERROR, NULL
;Check VAR_VALID_MIN, VAR_VALID_MAX, VAR_FILL_VALUE and Dataset data types match VAR_DATA_TYPE
s_dims=SIZE(sds,/DIMENSIONS)
pchkd=PTR_VALID(sds.data)
pchkv=PTR_VALID(sds.va_v)
pchkl=PTR_VALID(sds.va_l)
IF s_dims[0] GE 1 THEN BEGIN
attnamechk=['VAR_NAME','VAR_DATA_TYPE','VAR_VALID_MIN','VAR_VALID_MAX','VAR_FILL_VALUE']
n_anc=N_ELEMENTS(attnamechk)
FOR i=0,s_dims[0]-1 DO BEGIN
vdtx=BYTARR(n_anc)+255B ;VAR_DATA_TYPE for the attnamechk values
vnh=''
FOR j=0,s_dims[1]-1 DO BEGIN
IF (pchkl[i,j]) AND (pchkv[i,j]) THEN BEGIN
res=*sds[i,j].va_l & res=STRTRIM(STRUPCASE(res),2)
ai=WHERE(res EQ attnamechk,acnt)
IF acnt NE 0 THEN BEGIN
attval=*sds[i,j].va_v
IF ai[0] EQ 0 THEN vnh=STRTRIM(STRUPCASE(attval),2) $
ELSE IF ai[0] EQ 1 THEN BEGIN
vdth=STRTRIM(STRUPCASE(attval),2)
vi=WHERE(vdth EQ allowable_data_types,vcnt)
IF vcnt NE 0 THEN vdtx[1]=idl_data_type[vi[0]]
ENDIF ELSE vdtx[ai[0]]=SIZE(*sds[i,j].va_v,/TYPE)
ENDIF
ENDIF
ENDFOR
IF pchkd[i,0] THEN dvdtx=SIZE(*sds[i,0].data,/TYPE) ELSE dvdtx=255B ;Data type of the dataset
;PRINT,vnh,dvdtx,vdtx[1:4]
IF vdtx[1] NE 255B THEN BEGIN
IF (dvdtx NE vdtx[1]) AND (dvdtx NE 255B) THEN BEGIN
vi=WHERE(dvdtx EQ idl_data_type,vcnt)
IF vcnt NE 0 THEN svdt=allowable_data_types[vi[0]] ELSE svdt=''
IF svdt EQ '' THEN $
infotxt='3 '+vnh+' dataset has data type that does not match VAR_DATA_TYPE='+vdth $
ELSE $
infotxt='3 '+vnh+' dataset has data type '+svdt+', which does not match VAR_DATA_TYPE='+vdth
INFOTXT_OUTPUT,infotxt
ENDIF
FOR j=2,n_anc-1 DO BEGIN
IF vdtx[j] NE vdtx[1] THEN BEGIN
vi=WHERE(vdtx[j] EQ idl_data_type,vcnt)
IF vcnt NE 0 THEN svdt=allowable_data_types[vi[0]] ELSE svdt=''
IF svdt EQ '' THEN $
infotxt='3 '+vnh+' '+attnamechk[j]+ $
' value has data type that does not match VAR_DATA_TYPE='+vdth $
ELSE $
infotxt='3 '+vnh+' '+attnamechk[j]+' value has data type '+svdt+ $
', which does not match VAR_DATA_TYPE='+vdth
INFOTXT_OUTPUT,infotxt
ENDIF
ENDFOR
ENDIF
ENDFOR
ENDIF
ENDIF
;Define the HDF storage structure ;Define the HDF storage structure
ds_set={data: PTR_NEW()} ;SDS data array ds_set={data: PTR_NEW()} ;SDS data array
ds=REPLICATE(ds_set,nvn) ;Dimension the structure to the size of the SDS datasets ds=REPLICATE(ds_set,nvn) ;Dimension the structure to the size of the SDS datasets
...@@ -5937,7 +6001,7 @@ PRO idlcr8hdf, ga, sds, tav, odir, reterr, H5=o1, AVK=o2, LOG=o4, POPUP=o5, QA=o ...@@ -5937,7 +6001,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 documentation, idlcr8hdf-v4.0_Readme.pdf, available from http://avdc.gsfc.nasa.gov.
; ;
;Program sub-version 4.0b58 (20201211) ;Program sub-version 4.0b59 (20210617)
; ---------- ; ----------
;Written by Ian Boyd for the EVDC/AVDC - iboyd@astro.umass.edu ;Written by Ian Boyd for the EVDC/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