Skip to content
Denis Sergeev edited this page Dec 14, 2023 · 1 revision

Tips and tricks on XIOS - the I/O component of LFRic.

Examples of the output on a lat-lon grid

First, we define a lat-lon domain (e.g. in a file called domain_def_latlon.xml):

<!-- Output lat-lon domain definitions  -->
<domain_definition>
  <domain id="latlon1_domain" ni_glo="144" nj_glo="90" type="rectilinear" nvertex="1">
    <generate_rectilinear_domain />
    <interpolate_domain order="1" />
  </domain>
  <domain id="latlon2_domain" ni_glo="144" nj_glo="90" type="rectilinear" nvertex="1">
    <generate_rectilinear_domain />
    <interpolate_domain order="2" />
  </domain>
</domain_definition>

These are set with 144/90 points in the lat/lon directions. The interpolation order can be specified as order 1 or 2 (order of the conservative interpolation). According to the ESM website, "the second-order conservative calculation also includes the gradient across the source cell, so in general it gives a smoother, more accurate representation of the source field. This is particularly true when going from a coarse to finer grid." Also, iris-esmf-regrid uses an order-1 conservative interpolation by default.

Next, we connect the horizontal domain with a vertical axis (defined in a separate XML file) in a file called e.g. grid_def_latlon.xml:

!-- Output lat-lon grid definitions -->
<grid_definition>
  <grid id="ml_latlon1">
    <domain domain_ref="latlon1_domain" />
    <axis axis_ref="vert_axis_full_levels" />
  </grid>
  <grid id="hl_latlon1">
    <domain domain_ref="latlon1_domain" />
    <axis axis_ref="vert_axis_half_levels" />
  </grid>
</grid_definition>

Next, we import these definitions to the main iodef file:

    <!-- Include diagnostic domain definitions -->
    <domain_definition src="./domain_def_latlon.xml"/>

    <!-- Include grid definitions -->
    <grid_definition src="./grid_def_latlon.xml"/>

And then we can request diagnostics using these grid definitions:

  <file id="lfric_latlon_diags" name="lfric_latlon_diags" output_freq="1d" convention="CF" enabled=".TRUE.">
    <field_group operation="instant" freq_op="1d" grid_ref="fl_latlon1" >
      <field field_ref="theta" />
      <field field_ref="u_in_w3"/>
      <field field_ref="v_in_w3"/>
    </field_group>
    <field_group operation="instant" freq_op="1d" domain_ref="latlon1_domain" >
      <field field_ref="surface__grid_surface_temperature" />
    </field_group>
  </file>

Example of the vertical axis definition for an output on pressure levels:

<axis id="pressure_levels1" name="pressure" unit="Pa" positive="down" n_glo="17" value="(0,16)[100000. 92500. 85000. 70000. 60000. 50000. 40000. 30000. 25000. 20000. 15000. 10000. 7000. 5000. 3000. 2000. 1000.]">
    <interpolate_axis type="polynomial" order="1" coordinate="pressure_in_wth" />
</axis>