Skip to content

Conversation

xylar
Copy link
Collaborator

@xylar xylar commented Aug 28, 2025

This PR also fixes indexing in xdmf jinja template.

@xylar
Copy link
Collaborator Author

xylar commented Aug 28, 2025

Testing

I was able to run this successfully with the following 3-month time series of sea-surface height:

cd /lcrc/group/e3sm/ac.xylar/scratch/chrys/20250812.GMPAS-JRA1p5-DIB-PISMF-SIS.TL319_SOwISC12to30E3r4_ais4to20.coupler_budget.chrysalis/run
mpas_to_xdmf -m 20250812.GMPAS-JRA1p5-DIB-PISMF-SIS.TL319_SOwISC12to30E3r4_ais4to20.coupler_budget.chrysalis.mpaso.rst.0001-04-01_00000.nc -t 20250812.GMPAS-JRA1p5-DIB-PISMF-SIS.TL319_SOwISC12to30E3r4_ais4to20.coupler_budget.chrysalis.mpaso.hist.am.timeSeriesStatsMonthly.* -v timeMonthly_avg_ssh -x xtime_startMonthly -o xdmf_ssh

Without these fixes, I first saw an error:

  File "/gpfs/fs1/home/ac.xylar/mpas_work/MPAS-Tools/fix-paraview-extractor/conda_package/mpas_tools/viz/mpas_to_xdmf/io.py", line 96, in _load_dataset
    _set_time(ds=ds, xtime_var=xtime_var)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gpfs/fs1/home/ac.xylar/mpas_work/MPAS-Tools/fix-paraview-extractor/conda_package/mpas_tools/viz/mpas_to_xdmf/time.py", line 23, in _set_time
    raise ValueError(
        f"xtime variable '{xtime_var}' not found in dataset."
    )
ValueError: xtime variable 'xtime_startMonthly' not found in dataset.
(mpas_tools_dev) [ac.xasay-davis@chrlogin1 run]$ mpas_to_xdmf -m 20250

and then I saw an XDMF file that just repeated time index 0:

<?xml version="1.0" ?>
<Xdmf Version="3.0" xmlns:xi="http://www.w3.org/2001/XInclude">
  <Domain>
    <Grid Name="TimeSeries" GridType="Collection" CollectionType="Temporal">
      
      
      
      <Grid Name="Step0" GridType="Uniform">
        <Time Value="0.0"/>
        <Topology TopologyType="Polygon" NumberOfElements="807754" NodesPerElement="8">
          <DataItem Format="HDF" Dimensions="807754 8">fieldsOnCells.h5:/Cells</DataItem>
        </Topology>
        <Geometry GeometryType="XYZ">
          <DataItem Format="HDF" Dimensions="1631441 3">fieldsOnCells.h5:/Points</DataItem>
        </Geometry>
        
        
        <Attribute Name="timeMonthly_avg_ssh" AttributeType="Scalar" Center="Cell">
          <DataItem Format="HDF" Dimensions="807754">fieldsOnCells.h5:/timeMonthly_avg_ssh_t0</DataItem>
        </Attribute>
        
        
      </Grid>
      
      
      <Grid Name="Step0" GridType="Uniform">
        <Time Value="2676000.0"/>
        <Topology TopologyType="Polygon" NumberOfElements="807754" NodesPerElement="8">
          <DataItem Format="HDF" Dimensions="807754 8">fieldsOnCells.h5:/Cells</DataItem>
        </Topology>
        <Geometry GeometryType="XYZ">
          <DataItem Format="HDF" Dimensions="1631441 3">fieldsOnCells.h5:/Points</DataItem>
        </Geometry>
        
        
        <Attribute Name="timeMonthly_avg_ssh" AttributeType="Scalar" Center="Cell">
          <DataItem Format="HDF" Dimensions="807754">fieldsOnCells.h5:/timeMonthly_avg_ssh_t0</DataItem>
        </Attribute>
        
        
      </Grid>
      
      
      <Grid Name="Step0" GridType="Uniform">
        <Time Value="5095200.0"/>
        <Topology TopologyType="Polygon" NumberOfElements="807754" NodesPerElement="8">
          <DataItem Format="HDF" Dimensions="807754 8">fieldsOnCells.h5:/Cells</DataItem>
        </Topology>
        <Geometry GeometryType="XYZ">
          <DataItem Format="HDF" Dimensions="1631441 3">fieldsOnCells.h5:/Points</DataItem>
        </Geometry>
        
        
        <Attribute Name="timeMonthly_avg_ssh" AttributeType="Scalar" Center="Cell">
          <DataItem Format="HDF" Dimensions="807754">fieldsOnCells.h5:/timeMonthly_avg_ssh_t0</DataItem>
        </Attribute>
        
        
      </Grid>
      
      
      
    </Grid>
  </Domain>
</Xdmf>

@xylar xylar merged commit 184df39 into MPAS-Dev:master Aug 28, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant