Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
geoms
idlcr8
Commits
27ef9281
Commit
27ef9281
authored
Sep 30, 2020
by
Ian Boyd
Browse files
Replace idlcr8ascii.pro
parent
cdc116ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
idlcr8ascii.pro
View file @
27ef9281
;
Main
Program
Version
:
idlcr8ascii
.
pro
v4
.
0
b2
3
,
20
190821
;
Written
by
Ian
Boyd
for
the
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
Main
Program
Version
:
idlcr8ascii
.
pro
v4
.
0
b2
4
,
20
200930
;
Written
by
Ian
Boyd
for
the
EVDC
/
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
;
Sub
-
versions
:
;
v3
.
01
,
20081020
-
If
the
HDF4
file
is
created
using
the
HDF4
.
2
r3
library
,
then
extra
information
...
...
@@ -83,12 +83,15 @@
; sub-routines include is_a_number_ascii, alpha_numeric_underscore, nc_dimension_chk,
; file_format_a.
; v4.0b23 20190821 - Fixed bugs associated with H5 TAG_NAMES checks introduced in v4.0b22.
; v4.0b24 20200830 - Add INFORMATION messages (20-22) that identify issues with the VAR_DEPEND and VAR_SIZE
; attributes, that were previously fixed 'quietly' by the program; Check input GEOMS file
; for zero filesize before doing checks.
PRO idlcr8ascii_common
;Procedure to define the data COMMON block WIDGET_WIN_A, containing common variables
;associated with the Graphical User Interface
; ----------
; Written by Ian Boyd for the AVDC - iboyd@astro.umass.edu
; Written by Ian Boyd for the
EVDC/
AVDC - iboyd@astro.umass.edu
;
; History:
; 20061004: Introduced to IDLCR8ASCII - Version 2.0
...
...
@@ -114,7 +117,7 @@ END ; Procedure idlcr8ascii_common
PRO intro_a_event, ev
;Procedure to define how Events from the Start-up Introduction Window are handled
; ----------
;Written by Ian Boyd for the AVDC - iboyd@astro.umass.edu
;Written by Ian Boyd for the
EVDC/
AVDC - iboyd@astro.umass.edu
;
; History:
; 20061004: Introduced to IDLCR8ASCII - Version 2.0
...
...
@@ -177,7 +180,7 @@ PRO intro_a, intype
;or invalid parameters, or is called by IDL Virtual Machine. The user has a choice of continuing with
;the program after selecting input options, or stopping the program.
; ----------
;Written by Ian Boyd for the AVDC - iboyd@astro.umass.edu
;Written by Ian Boyd for the
EVDC/
AVDC - iboyd@astro.umass.edu
;
; History:
; 20061004: Introduced to IDLCR8ASCII - Version 2.0
...
...
@@ -202,7 +205,7 @@ COMMON WIDGET_WIN_A
;procedure which provides an introduction message before starting the program.
nhdr=46 & errtxt=STRARR(nhdr)
vertxt=['idlcr8ascii
-
v4
.
0
_Readme
.
pdf','v4
.
0
b2
3
August
20
19
']
vertxt=['idlcr8ascii
-
v4
.
0
_Readme
.
pdf','v4
.
0
b2
4
September
20
20
']
errtxt[1]='
Welcome
to
IDLcr8ASCII
.
This
program
reads
GEOMS
compliant
HDF4
,
HDF5
and
netCDF
files
and'
errtxt[2]='saves
contents
to
either
session
memory
,
an
output
window
(
summary
only
)
or
to
ASCII
or
formatted'
errtxt[3]='files
(
also
refer
to
'+vertxt[0]+'
).
'
...
...
@@ -294,7 +297,7 @@ END ;Intro_A
PRO
idlcr8ascii_event
,
ev
;
Procedure
to
close
the
pop
-
up
logging
window
after
user
selects
'Finish'
.
;
----------
;
Written
by
Ian
Boyd
for
the
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
Written
by
Ian
Boyd
for
the
EVDC
/
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
;
History
:
;
20061004
:
Introduced
to
IDLCR8ASCII
-
Version
2.0
...
...
@@ -320,7 +323,7 @@ PRO stop_with_error_a, txt1, txt2, lu
;
is
displayed
in
one
or
more
of
the
following
:
a
Pop
-
up
dialog
window
;
the
Pop
-
up
logging
;
window
;
the
Output
Logging
window
in
the
IDLDE
.
;
----------
;
Written
by
Ian
Boyd
for
the
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
Written
by
Ian
Boyd
for
the
EVDC
/
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
;
History
:
;
20050729
:
Original
IDLCR8ASCII
Routine
-
Version
1.0
...
...
@@ -354,7 +357,7 @@ COMMON WIDGET_WIN_A
IF
lu
NE
-
1
L
THEN
FREE_LUN
,
lu
IF
txt1
EQ
''
THEN
BEGIN
;
<
cancel
>
chosen
on
Intro
box
res
=
DIALOG_MESSAGE
(
'IDLcr8ASCII Stopped!'
,
/
Information
,
Title
=
'AVDC IDLcr8ASCII'
)
res
=
DIALOG_MESSAGE
(
'IDLcr8ASCII Stopped!'
,
/
Information
,
Title
=
'
EVDC/
AVDC IDLcr8ASCII'
)
ENDIF
ELSE
BEGIN
IF
STRMID
(
txt1
,
0
,
2
)
EQ
'D_'
THEN
txtx
=
STRMID
(
txt1
,
2
)
ELSE
txtx
=
txt1
FOR
i
=
dux
[
0
],
dux
[
1
],
dux
[
2
]
DO
BEGIN
...
...
@@ -371,7 +374,7 @@ ENDIF ELSE BEGIN
;
write
error
to
DIALOG
Box
instead
of
Popup
window
errtxt2
=
STRARR
(
4
)
errtxt2
[
0
]
=
STRMID
(
txt1
,
2
)
&
errtxt2
[
1
]
=
txt2
&
errtxt2
[
3
]
=
'IDLcr8ASCII Stopped!'
res
=
DIALOG_MESSAGE
(
errtxt2
,
/
Error
,
Title
=
'AVDC IDLcr8ASCII Error'
)
res
=
DIALOG_MESSAGE
(
errtxt2
,
/
Error
,
Title
=
'
EVDC/
AVDC IDLcr8ASCII Error'
)
ENDIF
ELSE
IF
rerr
EQ
'NA'
THEN
BEGIN
;
write
error
to
Popup
window
lineno
=
lineno
+
4
L
WIDGET_CONTROL
,
wtxt
,
set_value
=
' ERROR in '
+
txt1
,
/
Append
...
...
@@ -383,7 +386,7 @@ ENDIF ELSE BEGIN
ENDIF
ENDELSE
HEAP_GC
IF
rerr
EQ
'NA'
THEN
RETALL
ELSE
rerr
=
'Unable to read HDF or NC file - '
+
txtx
+
txt2
IF
rerr
EQ
'NA'
THEN
RETALL
ELSE
rerr
=
'Unable to read HDF or NC file - '
+
txt2
END
;
Procedure
Stop_With_Error_A
...
...
@@ -442,7 +445,7 @@ PRO infotxt_output_a, in0, in1
;
This
information
can
be
reported
to
a
Pop
-
up
logging
window
,
IDLDE
output
log
window
,
and
/
or
;
the
log
file
.
Code
for
this
output
was
originally
written
directly
in
the
affected
procedures
;
----------
;
Written
by
Ian
Boyd
for
the
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
Written
by
Ian
Boyd
for
the
EVDC
/
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
;
History
:
;
20090311
:
Introduced
to
IDLCR8ASCII
-
Version
3.02
...
...
@@ -581,6 +584,15 @@ CASE 1 OF
in0
[
0
]
EQ
19
:
BEGIN
infotxt
=
' INFORMATION: '
+
in1
[
0
]
+
' is not a valid GEOMS Metadata Attribute'
END
in0
[
0
]
EQ
20
:
BEGIN
infotxt
=
' INFORMATION: VAR_SIZE entry must be written to the file as a STRING for '
+
in1
[
0
]
END
in0
[
0
]
EQ
21
:
BEGIN
infotxt
=
' INFORMATION: '
+
in1
[
0
]
+
' sub-values must be separated by '';'' for '
+
in1
[
1
]
END
in0
[
0
]
EQ
22
:
BEGIN
infotxt
=
' INFORMATION: Spaces not permitted in the '
+
in1
[
0
]
+
' entry for '
+
in1
[
1
]
END
ENDCASE
dm
=
SIZE
(
infotxt
,
/
N_Elements
)
...
...
@@ -928,11 +940,11 @@ END ;File_Format_A
PRO
test_dim_order
,
va_name
,
va_value
,
va_type
,
sds_dim
,
rev_vd_vs
PRO
test_dim_order
,
va_name
,
va_value
,
va_type
,
sds_dim
,
sds_name
,
rev_vd_vs
;
Procedure
to
test
the
dimension
ordering
of
any
multi
-
dimensional
datasets
in
the
input
DF
file
,
and
;
return
correct
ordering
code
(
dimension
ordering
for
idlcr8ascii
uses
IDL
/
Fortran
convention
)
;
----------
;
Written
by
Ian
Boyd
for
the
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
Written
by
Ian
Boyd
for
the
EVDC
/
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
;
History
:
;
20111208
:
Introduced
-
Version
4.0
b4
...
...
@@ -943,17 +955,20 @@ PRO test_dim_order, va_name, va_value, va_type, sds_dim, rev_vd_vs
;
20141110
:
Fix
bug
that
caused
multi
-
dimensional
array
ordering
to
not
be
correctly
identified
;
if
the
first
dataset
to
be
checked
in
the
file
had
the
same
number
of
elements
in
;
the
array
(
e
.
g
.
was
a
set
of
Averaging
Kernels
)
-
Version
4.0
b9
;
20200930
:
Add
INFORMATION
messages
(
20
-
22
)
that
identify
issues
with
the
VAR_DEPEND
and
VAR_SIZE
;
attributes
that
were
previously
fixed
'quietly'
by
the
program
;
Add
sds_name
to
the
;
variables
required
by
the
procedure
-
Version
4.0
b24
;
;
Inputs
:
va_name
-
An
abbreviated
version
of
the
Variable
Name
;
either
'VD'
(
VAR_DEPEND
)
or
'VS'
;
(
VAR_SIZE
)
;
va_value
-
The
corresponding
Variable
Value
;
sds_dim
-
Dimension
information
for
the
DF
Dataset
being
tested
;
sds_name
-
Dataset
name
,
required
if
an
INFORMATION
message
is
generated
;
;
Outputs
:
rev_vd_vs
-
Scalar
to
indicate
whether
VAR_DEPEND
and
VAR_SIZE
values
(
and
data
,
in
the
case
;
of
netCDF
measurements
)
need
to
be
reversed
;
;
Called
by
:
Read_HDF_SDS
;
IF
va_type
NE
'STRING'
THEN
BEGIN
;
VAR_SIZE
contains
numeric
values
instead
of
in
the
form
of
a
string
vavhold
=
''
&
n_vav
=
N_ELEMENTS
(
va_value
)
...
...
@@ -961,9 +976,22 @@ IF va_type NE 'STRING' THEN BEGIN ;VAR_SIZE contains numeric values instead of i
IF
k
EQ
n_vav
-
1
THEN
vtxt
=
''
ELSE
vtxt
=
';'
vavhold
=
vavhold
+
STRTRIM
(
va_value
[
k
],
2
)
+
vtxt
ENDFOR
INFOTXT_OUTPUT_A
,[
20
],[
STRTRIM
(
sds_name
,
2
)]
ENDIF
ELSE
vavhold
=
va_value
vs_v
=
STRCOMPRESS
(
STRSPLIT
(
vavhold
,
';, '
,
/
EXTRACT
,
COUNT
=
rcnt
),
/
REMOVE_ALL
)
IF
(
rcnt
GT
1
)
AND
((
STRPOS
(
vavhold
,
';'
)
EQ
-
1
)
OR
(
STRPOS
(
vavhold
,
','
)
NE
-
1
))
THEN
BEGIN
IF
va_name
EQ
'VD'
THEN
itxt
=
'VAR_DEPEND'
ELSE
itxt
=
'VAR_SIZE'
INFOTXT_OUTPUT_A
,[
21
],[
itxt
,
STRTRIM
(
sds_name
,
2
)]
;
sub
-
values
should
be
separated
by
';'
ENDIF
IF
(
rcnt
EQ
1
)
OR
((
rcnt
GT
1
)
AND
(
STRPOS
(
vavhold
,
';'
)
NE
-
1
))
THEN
BEGIN
IF
STRCOMPRESS
(
vavhold
,
/
REMOVE_ALL
)
NE
vavhold
THEN
BEGIN
IF
va_name
EQ
'VD'
THEN
itxt
=
'VAR_DEPEND'
ELSE
itxt
=
'VAR_SIZE'
INFOTXT_OUTPUT_A
,[
22
],[
itxt
,
STRTRIM
(
sds_name
,
2
)]
;
no
spaces
permitted
ENDIF
ENDIF
IF
va_name
EQ
'VD'
THEN
BEGIN
;
VAR_DEPEND
tests
dti
=
WHERE
(
STRUPCASE
(
vs_v
)
EQ
'DATETIME'
,
dticnt
)
;
Note
:
if
DATETIME
has
VAR_SIZE
=
1
then
the
ordering
is
dependent
on
the
order
of
the
VAR_SIZE
values
only
...
...
@@ -1015,7 +1043,7 @@ PRO read_hdf_sds, ifile, ga, sds, catinfo
;
Procedure
to
read
the
contents
of
a
GEOMS
standard
HDF4
or
HDF5
compatible
file
;
into
session
memory
;
----------
;
Written
by
Ian
Boyd
for
the
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
Written
by
Ian
Boyd
for
the
EVDC
/
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
;
History
:
;
20050729
:
Original
IDLCR8ASCII
Routine
-
Version
1.0
...
...
@@ -1089,6 +1117,7 @@ PRO read_hdf_sds, ifile, ga, sds, catinfo
; null termination character (which causes an error in the H5A_Read routine)
; - Version 4.0b22
; 20190821 Fixed bugs associated with H5 TAG_NAMES checks introduced in v4.0b22 - Version 4.0b23
; 20200930 Add sds_name to TEST_DIM_ORDER procedure call - Version 4.0b24
;
; Inputs: ifile - a string containing the name of the input file to be read in.
; catinfo - a string array identifying the type of input file ('
H4
','
H5
','
NC
')
...
...
@@ -1294,9 +1323,9 @@ IF catinfo[0,0] EQ 'H4' THEN BEGIN
ELSE
itxt
=
[
sds_type
,
va_value
]
ENDIF
ENDIF
ELSE
IF
STRUPCASE
(
va_name
)
EQ
'VAR_DEPEND'
THEN
$
;
do
dimension
ordering
checks
TEST_DIM_ORDER
,
'VD'
,
va_value
,
va_type
,
sds_dim
,
rev_vd_vs
$
TEST_DIM_ORDER
,
'VD'
,
va_value
,
va_type
,
sds_dim
,
sds_name
,
rev_vd_vs
$
ELSE
IF
STRUPCASE
(
va_name
)
EQ
'VAR_SIZE'
THEN
$
;
do
dimension
ordering
checks
TEST_DIM_ORDER
,
'VS'
,
va_value
,
va_type
,
sds_dim
,
rev_vd_vs
TEST_DIM_ORDER
,
'VS'
,
va_value
,
va_type
,
sds_dim
,
sds_name
,
rev_vd_vs
ENDFOR
ENDIF
ELSE
BEGIN
;
No
Variable
Attributes
found
vcnt
=
3
...
...
@@ -1599,10 +1628,10 @@ ENDIF ELSE IF catinfo[0,0] EQ 'H5' THEN BEGIN ;HDF5 or netCDF4 format file
IF
vcnt
EQ
0
THEN
INFOTXT_OUTPUT_A
,[
2
],[
sds_name
,
va_value
]
END
STRUPCASE
(
da_name
)
EQ
'VAR_DEPEND'
:
BEGIN
TEST_DIM_ORDER
,
'VD'
,
va_value
,
va_type
,
sds_dim
,
rev_vd_vs
TEST_DIM_ORDER
,
'VD'
,
va_value
,
va_type
,
sds_dim
,
sds_name
,
rev_vd_vs
END
STRUPCASE
(
da_name
)
EQ
'VAR_SIZE'
:
BEGIN
TEST_DIM_ORDER
,
'VS'
,
va_value
,
va_type
,
sds_dim
,
rev_vd_vs
TEST_DIM_ORDER
,
'VS'
,
va_value
,
va_type
,
sds_dim
,
sds_name
,
rev_vd_vs
END
ELSE
:
ENDCASE
...
...
@@ -1838,10 +1867,10 @@ ENDIF ELSE BEGIN ;netCDF3 file
IF
vcnt
EQ
0
THEN
INFOTXT_OUTPUT_A
,[
2
],[
sds_name
,
va_value
]
END
STRUPCASE
(
va_name
)
EQ
'VAR_DEPEND'
:
BEGIN
TEST_DIM_ORDER
,
'VD'
,
va_value
,
va_type
,
sds_dim
,
rev_vd_vs
TEST_DIM_ORDER
,
'VD'
,
va_value
,
va_type
,
sds_dim
,
sds_name
,
rev_vd_vs
END
STRUPCASE
(
va_name
)
EQ
'VAR_SIZE'
:
BEGIN
TEST_DIM_ORDER
,
'VS'
,
va_value
,
va_type
,
sds_dim
,
rev_vd_vs
TEST_DIM_ORDER
,
'VS'
,
va_value
,
va_type
,
sds_dim
,
sds_name
,
rev_vd_vs
END
ELSE
:
ENDCASE
...
...
@@ -2059,7 +2088,7 @@ PRO output_hdf_data, ifile, ga, sds, catinfo
;
Procedure
to
output
the
contents
of
an
HDF
file
in
ASCII
form
,
either
in
a
format
compatible
for
;
conversion
back
to
HDF
,
or
in
Row
and
Column
format
,
or
as
a
summary
list
;
----------
;
Written
by
Ian
Boyd
for
the
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
Written
by
Ian
Boyd
for
the
EVDC
/
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
;
History
:
;
20050729
:
Original
IDLCR8ASCII
Routine
-
Version
1.0
...
...
@@ -2230,9 +2259,9 @@ PRO idlcr8ascii, ifile, ga, sds, reterr, $
;
;
Program
documentation
,
idlcr8ascii
-
v4
.
0
_Readme
.
pdf
,
available
on
http
://
avdc
.
gsfc
.
nasa
.
gov
.
;
;
Program
sub
-
version
4.0
b2
3
(
20
190621
)
;
Program
sub
-
version
4.0
b2
4
(
20
200930
)
;
----------
;
Written
by
Ian
Boyd
for
the
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
Written
by
Ian
Boyd
for
the
EVDC
/
AVDC
-
iboyd
@
astro
.
umass
.
edu
;
;
History
:
;
20050729
:
Original
Release
-
Version
1.0
...
...
@@ -2274,6 +2303,8 @@ PRO idlcr8ascii, ifile, ga, sds, reterr, $
; 20160213: Add CATCH, /CANCEL after idlcr8hdf call - Version 4.0b13
; 20190806: Call routine FILE_FORMAT_A to determine the correct format of the input file(s)
; - Version 4.0b22
; 20200930: Check that GEOMS file does not have filesize of zero before calling FILE_FORMAT_A
; - Version 4.0b24
;
; Inputs: ifile - a string array or filespec containing the name of the HDF file(s) to be read in
;
...
...
@@ -2486,7 +2517,7 @@ FOR ndf=0L,nfile-1L DO BEGIN
ENDFOR
ftype='
XX
'
IF FILE_TEST(ifile[ndf])
EQ 1
THEN BEGIN
IF
(
FILE_TEST(ifile[ndf])
) AND (~FILE_TEST(ifile[ndf],/ZERO_LENGTH))
THEN BEGIN
;Identify the file format
ftype=FILE_FORMAT_A(ifile[ndf])
IF ftype NE '
XX
' THEN catinfo[0,0]=ftype
...
...
@@ -2624,7 +2655,7 @@ IF o3[3] EQ '' THEN BEGIN
WIDGET_CONTROL
,
wtxt
,
set_value
=
'HDF file read completed - hit <Finish> to close program'
,
/
Append
XMANAGER
,
'idlcr8ascii'
,
base
ENDIF
ELSE
IF
intype
LT
0
THEN
BEGIN
;
Create
Finish
Dialog
Box
res
=
DIALOG_MESSAGE
(
'HDF file read completed!'
,
/
Information
,
Title
=
'AVDC IDLcr8ASCII'
)
res
=
DIALOG_MESSAGE
(
'HDF file read completed!'
,
/
Information
,
Title
=
'
EVDC/
AVDC IDLcr8ASCII'
)
ENDIF
END
;
procedure
IDLcr8ASCII
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment