From 21eaf46d559153088cbe1c6b804bd19ed62cd865 Mon Sep 17 00:00:00 2001
From: Ian Boyd <iboyd@astro.umass.edu>
Date: Tue, 26 Nov 2024 03:00:32 +0000
Subject: [PATCH] Replace idlcr8hdf.pro

---
 idlcr8hdf.pro | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/idlcr8hdf.pro b/idlcr8hdf.pro
index f596ef3..9b0eee7 100644
--- a/idlcr8hdf.pro
+++ b/idlcr8hdf.pro
@@ -1,4 +1,4 @@
-;Main Program Version: idlcr8hdf.pro v4.0b65, 20241029
+;Main Program Version: idlcr8hdf.pro v4.0b66, 20241111
 ;  Written by Ian Boyd for the EVDC/AVDC - iboyd@bryanscientific.org
 ;
 ;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.0b65 October 2024']
+vertxt=['idlcr8hdf-v4.0_Readme.pdf','v4.0b66 November 2024']
 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):'
@@ -6162,7 +6162,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.0b65 (20241029)
+;Program sub-version 4.0b66 (20241111)
 ; ----------
 ;Written by Ian Boyd for the EVDC/AVDC - iboyd@bryanscientific.org
 ;
@@ -6213,6 +6213,9 @@ PRO idlcr8hdf, ga, sds, tav, odir, reterr, H5=o1, AVK=o2, LOG=o4, POPUP=o5, QA=o
 ;    20180218: Ensure variable attribute value (vav) is only a single variable when calling
 ;              PRE_DEFINED_ATT_CHECKS - Version 4.0b45
 ;    20181221: Allow compression and shuffle options when creating HDF5 files - Version 4.0b49
+;    20241111: Fix bug to treat BYTE metadata entries the same as other numeric datatypes when 
+;              writing metafile array from session memory input. Previously STRING(FIX(vav[k])) and
+;              changed to STRTRIM(FIX(vav[k]),2) - Version 4.0b66
 ;
 ;  Inputs: DIALOG PROMPTS WITH IDL VIRTUAL MACHINE (File input only)
 ;            Metadata template file - The program will fill in missing spaces based on data file and
@@ -6289,7 +6292,7 @@ COMMON DATA
 COMMON WIDGET_WIN
 
 ;Possible error message for this procedure
-proname='IDLcr8HDF procedure: ' & lu=-1L
+proname='IDLcr8HDF procedure: ' & lu=(-1L)
 errtxt=STRARR(6)
 errtxt[0]=' selection not valid'
 errtxt[1]='Global Attributes Array is not of type string, or is not one dimensional'
@@ -6536,11 +6539,11 @@ ENDIF ELSE BEGIN ;SDS is a data structure, so do initial checks on parameters
             n_vav=N_ELEMENTS(vav)
             FOR k=0,n_vav-1 DO BEGIN
               IF k EQ 0 THEN BEGIN
-                IF vavt EQ 1 THEN metafile[pcnt]=*sds[i,j].va_l+'='+STRING(FIX(vav[k])) $
+                IF vavt EQ 1 THEN metafile[pcnt]=*sds[i,j].va_l+'='+STRTRIM(FIX(vav[k]),2) $ ;Byte - need to treat the same as any other numeric type (20241111)
                 ELSE IF vavt EQ 7 THEN metafile[pcnt]=*sds[i,j].va_l+'='+STRING(vav[k]) $ ;save all values as a string representation
                 ELSE metafile[pcnt]=*sds[i,j].va_l+'='+STRTRIM(vav[k],2)
               ENDIF ELSE BEGIN
-                IF vavt EQ 1 THEN metafile[pcnt]=metafile[pcnt]+';'+STRING(FIX(vav[k])) $
+                IF vavt EQ 1 THEN metafile[pcnt]=metafile[pcnt]+';'+STRTRIM(FIX(vav[k]),2) $ ;Byte - need to treat the same as any other numeric type (20241111)
                 ELSE IF vavt EQ 7 THEN metafile[pcnt]=metafile[pcnt]+';'+STRING(vav[k]) $
                 ELSE metafile[pcnt]=metafile[pcnt]+';'+STRTRIM(vav[k],2)
               ENDELSE
-- 
GitLab