# Stream xml get attribute failed

**URL:** <https://forums.jcsda.org/t/stream-xml-get-attribute-failed/342>\
**Category:** JEDI\
**Created:** [July 6, 2022, 1:10pm UTC](https://forums.jcsda.org/t/stream-xml-get-attribute-failed/342 "2022-07-06T13:10:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LL\_GZ](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/ll_gz/32/107_2.png) [@LL\_GZ](https://forums.jcsda.org/u/LL_GZ)\
**Post date:** [July 6, 2022, 1:10pm UTC](https://forums.jcsda.org/t/stream-xml-get-attribute-failed/342/1 "2022-07-06T13:10:47Z")

</div>

When I use JEDI-MPAS for simulating observations, I encounter the following error report. According to the prompt, I think there is a problem with my XML file streams.atmposhere, but I don’t know what is wrong.

```auto
----------------------------------------------------------------------
Beginning MPAS-atmosphere Output Log File for task 0 of 1
    Opened at 2022/07/06 21:03:43
----------------------------------------------------------------------

 Using default double-precision reals

 Reading namelist from file ./DATA/120km/namelist.atmosphere

 ----- Setting up physics suite 'mesoscale_reference' -----

     config_microp_scheme = mp_wsm6
     config_convection_scheme = cu_ntiedtke
     config_pbl_scheme = bl_ysu
     config_gwdo_scheme = bl_ysu_gwdo
     config_radt_cld_scheme = cld_fraction
     config_radt_lw_scheme = rrtmg_lw
     config_radt_sw_scheme = rrtmg_sw
     config_sfclayer_scheme = sf_monin_obukhov
     config_lsm_scheme = noah

 ----- Setting up package variables -----

     mp_kessler_in = F
     mp_thompson_in = F
     mp_wsm6_in = T
     cu_grell_freitas_in = F
     cu_kain_fritsch_in = F
     cu_tiedtke_in = T
     bl_mynn_in = F
     bl_ysu_in = T

 Reading streams configuration from file ./DATA/120km/streams.atmosphere
CRITICAL ERROR: stream xml get attribute failed: ./DATA/120km/streams.atmosphere

 -----------------------------------------
 Total log messages printed:
    Output messages = 29
    Warning messages = 0
    Error messages = 0
    Critical error messages = 1
 -----------------------------------------
 Logging complete. Closing file at 2022/07/06 21:03:43

```

My streams.atmposhere file is:

```auto
<streams>
<immutable_stream name="input"
                  type="input"
                  filename_template="x1.40962.init.nc"
                  input_interval="initial_only" />

<immutable_stream name="restart"
                  type="input;output"
                  filename_template="./DATA/120km/bg/restart.$Y-$M-$D_$h.$m.$s.nc"
                  input_interval="initial_only"
                  clobber_mode="overwrite"
                  output_interval="1:00:00" />

<stream name="output"
        type="input:output"
        filename_template="history.$Y-$M-$D_$h.$m.$s.nc"
        clobber_mode="overwrite"
        input_interval="initial_only"
        output_interval="6:00:00" >
        <file name="stream_list.atmosphere.output"/>
</stream>

<stream name="diagnostics"
        type="output"
        filename_template="diag.$Y-$M-$D_$h.$m.$s.nc"
        clobber_mode="overwrite"
        output_interval="none" >
        <file name="stream_list.atmosphere.diagnostics"/>
</stream>

<stream name="surface"
        type="none"
        filename_template="x1.40962.sfc_update.nc"
        filename_interval="none"
        input_interval="none" >
        <file name="stream_list.atmosphere.surface"/>
</stream>

<immutable_stream name="iau"
                  type="none"
                  filename_template="x1.40962.AmB.$Y-$M-$D_$h.$m.$s.nc"
                  filename_interval="none"
                  packages="iau"
                  input_interval="none" />
</streams>

```

---

<div class="post-metadata">

**Author:** ![byoung-joo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/byoung-joo/32/126_2.png) [@byoung-joo](https://forums.jcsda.org/u/byoung-joo)\
**Post date:** [July 6, 2022, 7:23pm UTC](https://forums.jcsda.org/t/stream-xml-get-attribute-failed/342/2 "2022-07-06T19:23:06Z")

</div>

Hi @LL_GZ,

I guess that you set the 120 km MPAS background files, based on the JEDI-MPAS 1.0.0 tutorials. Your `streams.atmosphere` file looks okay to me.

First, can you check if either `x1.40962.init.nc` file or `./DATA/120km/bg/restart.$Y-$M-$D_$h.$m.$s.nc` file exist ?

I think you do not use the 2-stream I/O approach ([Tutorial: Simulating Observations with a JEDI-MPAS Application — JEDI Documentation 1 documentation](https://jointcenterforsatellitedataassimilation-jedi-docs.readthedocs-hosted.com/en/1.2.0/learning/tutorials/level2/hofx-mpas.html#step-4-introduction-to-2-stream-i-o)). Then, the JEDI-MPAS should use the `restart` mode of MPAS. So, please check if `config_do_restart` was set as `true` under `&restart` section of MPAS namelist file.

Let me know if this helps!

---

<div class="post-metadata">

**Author:** ![LL\_GZ](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/ll_gz/32/107_2.png) [@LL\_GZ](https://forums.jcsda.org/u/LL_GZ)\
**Post date:** [July 7, 2022, 2:50am UTC](https://forums.jcsda.org/t/stream-xml-get-attribute-failed/342/3 "2022-07-07T02:50:03Z")

</div>

When I set config\_do\_restart=true, this error was solved. But then when I ran it, I encountered a new error as follows. It looks like the program can not find the hdf library, but I did not encounter such a bug in the Hofx tutorial. I use [obs2ioda.x](https://forums.jcsda.org/t/observation-data-for-simulating-observations/232) to get my observation data. Is there a problem with the observations I converted?

```auto
Radiosonde vars: 4 variables: air_temperature, eastward_wind, northward_wind, specific_humidity
HDF5-DIAG: Error detected in HDF5 (1.12.0) MPI-process 0:
  #000: ../../src/H5D.c line 296 in H5Dopen2(): unable to open dataset
    major: Dataset
    minor: Can't open object
  #001: ../../src/H5VLcallback.c line 1974 in H5VL_dataset_open(): dataset open failed
    major: Virtual Object Layer
    minor: Can't open object
  #002: ../../src/H5VLcallback.c line 1941 in H5VL__dataset_open(): dataset open failed
    major: Virtual Object Layer
    minor: Can't open object
  #003: ../../src/H5VLnative_dataset.c line 125 in H5VL__native_dataset_open(): unable to open dataset
    major: Dataset
    minor: Can't open object
  #004: ../../src/H5Dint.c line 1482 in H5D__open_name(): not found
    major: Dataset
    minor: Object not found
  #005: ../../src/H5Gloc.c line 462 in H5G_loc_find(): can't find object
    major: Symbol table
    minor: Object not found
  #006: ../../src/H5Gtraverse.c line 855 in H5G_traverse(): internal path traversal failed
    major: Symbol table
    minor: Object not found
  #007: ../../src/H5Gtraverse.c line 744 in H5G__traverse_real(): component not found
    major: Symbol table
    minor: Object not found
==> destruct MPAS corelist and domain: 0
Exception: Reason: An exception occurred inside ioda while opening a variable.
        name: virtual_temperature@ObsError

```

---

<div class="post-metadata">

**Author:** ![byoung-joo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/byoung-joo/32/126_2.png) [@byoung-joo](https://forums.jcsda.org/u/byoung-joo)\
**Post date:** [July 7, 2022, 4:51pm UTC](https://forums.jcsda.org/t/stream-xml-get-attribute-failed/342/4 "2022-07-07T16:51:16Z")

</div>

I’m glad that it fixed your issue.

I don’t know what cause the HDF related error. But we have recently encountered the same error message `HDF5-DIAG: Error detected in HDF5 (1.12.0) MPI-process 0:` when the observation file was unintentionally removed. So, can you please double check if the path for the observation file ( under `obs space`.`obsdatain`.`obsfilein` key) is correct in your yaml file ? This might not be a reason for the error because the error message also said `Exception: Reason: An exception occurred inside ioda while opening a variable. `

The other thing is… JEDI-MPAS 1.0.0 requires IODA Version 2 format for the observation files. So I wonder which version of [obs2ioda.x](https://forums.jcsda.org/t/observation-data-for-simulating-observations/232) is used to generate your obs files: `obs2ioda-v1` or `obs2ioda-v2`. Also please check if there is an executable `bin/ioda-upgrade.x` under your build directory. This executable converts the IODA V1 format into V2 format.

---

<div class="post-metadata">

**Author:** ![LL\_GZ](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/ll_gz/32/107_2.png) [@LL\_GZ](https://forums.jcsda.org/u/LL_GZ)\
**Post date:** [July 9, 2022, 2:32am UTC](https://forums.jcsda.org/t/stream-xml-get-attribute-failed/342/5 "2022-07-09T02:32:38Z")

</div>

I started with obs2iodav1 and ioda-upgrade.x is executable. Then I tried obs2iodav2 to convert the observation file and the error report became the following:

```auto
Radiosonde vars: 4 variables: air_temperature, eastward_wind, northward_wind, specific_humidity
WARNING: ObsSpace::createVariables: Skipping variable due to an unexpected data type for variable: MetaData/dateTime
==> destruct MPAS corelist and domain: 0
Exception: Reason: An exception occurred inside ioda while opening a variable.
        name: MetaData/dateTime
        source_column: 0
        source_filename: /fs1/home/tianxj/yhluo/jedi/mpas-bundle/ioda/src/engines/ioda/src/ioda/Has_Variables.cpp
        source_function: virtual ioda::Variable ioda::detail::Has_Variables_Base::open(const string&) const
        source_line: 107

Exception: oops::HofX3D<MPAS, UFO and IODA observations> terminating...

```

According to the error report, it seems to point to an extra variable of dataTime in Metadata. I checked the converted sondes\_obs\_2017081000.h5 file with ncdump and found that MetaData does.

```auto
$ ncdump -h sondes_obs_2017081000.h5
netcdf sondes_obs_2017081000 {
dimensions:
        nvars = 5 ;
        nlocs = 71446 ;
        nstring = 50 ;

// global attributes:
                :nvars = 5 ;
                :nlocs = 71446 ;
                :nstring = 50 ;
                :min_datetime = "2017-08-09T20:31:48Z" ;
                :max_datetime = "2017-08-10T03:45:57Z" ;

group: MetaData {
  variables:
        float air_pressure(nlocs) ;
                air_pressure:_FillValue = -999.f ;
        float height(nlocs) ;
                height:_FillValue = -999.f ;
        float station_elevation(nlocs) ;
                station_elevation:_FillValue = -999.f ;
        float latitude(nlocs) ;
                latitude:_FillValue = -999.f ;
        float longitude(nlocs) ;
                longitude:_FillValue = -999.f ;
        int64 dateTime(nlocs) ;
                dateTime:units = "seconds since 1970-01-01T00:00:00Z" ;
        char station_id(nlocs, nstring) ;
        char variable_names(nvars, nstring) ;
  } // group MetaData
......

```

So besides using obs2ioda, is there a better way to convert observations to ioda format?

---

<div class="post-metadata">

**Author:** ![airphons](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@airphons](https://forums.jcsda.org/u/airphons)\
**Post date:** [October 24, 2022, 8:49am UTC](https://forums.jcsda.org/t/stream-xml-get-attribute-failed/342/6 "2022-10-24T08:49:20Z")

</div>

I encountered a similar problem, saying “dateTime” error.  
Did you solve it?
