Currently we don't support cylindrical EPOCH (CE). Upon running a preliminary test using the example deck gaussian_pulse.deck it falls over when attempting to acquire the grid for a given variable.
>>> ds = sdfxr.open_dataset("/Users/joel/Source/cylindrical_epoch/epoch_axial/test/0001.sdf")
File ~/Source/sdf-xarray/src/sdf_xarray/__init__.py:855, in SDFDataStore.load(self)
852 dim_size_lookup = defaultdict(dict)
--> 853 grid = self.ds.grids[value.grid]
856 grid_base_name = _process_grid_name(grid.name, _norm_grid_name)
857 for dim_size, dim_name in zip(grid.shape, grid.labels):
KeyError: 'mode_grid'
This is due to the mode_grid not existing in the list of grids
>>> sdfxr.SDFFile("/Users/joel/Source/cylindrical_epoch/epoch_axial/test/0000.sdf").grids
{'grid': Mesh(_id='grid', name='Grid/Grid', dtype=dtype('float64'), shape=(501, 101), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d076680>, units=('m', 'm'), labels=('X', 'Y'), mults=(1.0, 1.0), parent=None),
'grid_mid': Mesh(_id='grid', name='Grid/Grid_mid', dtype=dtype('float64'), shape=(500, 100), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d076680>, units=('m', 'm'), labels=('X', 'Y'), mults=(1.0, 1.0), parent=Mesh(_id='grid', name='Grid/Grid', dtype=dtype('float64'), shape=(501, 101), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d076680>, units=('m', 'm'), labels=('X', 'Y'), mults=(1.0, 1.0), parent=None)),
'grid_cpu_rank': Mesh(_id='grid_cpu_rank', name='Grid/CPUs/Original rank', dtype=dtype('float64'), shape=(3, 5), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d076680>, units=('m', 'm'), labels=('X', 'Y'), mults=None, parent=None),
'grid_cpu_rank_mid': Mesh(_id='grid_cpu_rank', name='Grid/CPUs/Original rank_mid', dtype=dtype('float64'), shape=(2, 4), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d076680>, units=('m', 'm'), labels=('X', 'Y'), mults=None, parent=Mesh(_id='grid_cpu_rank', name='Grid/CPUs/Original rank', dtype=dtype('float64'), shape=(3, 5), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d076680>, units=('m', 'm'), labels=('X', 'Y'), mults=None, parent=None)),
'grid_cpus_current': Mesh(_id='grid_cpus_current', name='Grid/CPUs/Current rank', dtype=None, shape=(2, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d076680>, units=('m', 'm'), labels=('X', 'Y'), mults=None, parent=None),
'grid_cpus_current_mid': Mesh(_id='grid_cpus_current', name='Grid/CPUs/Current rank_mid', dtype=None, shape=(1, 1), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d076680>, units=('m', 'm'), labels=('X', 'Y'), mults=None, parent=Mesh(_id='grid_cpus_current', name='Grid/CPUs/Current rank', dtype=None, shape=(2, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d076680>, units=('m', 'm'), labels=('X', 'Y'), mults=None, parent=None))}
However all the variables in the file are using it
>>> sdfxr.SDFFile("/Users/joel/Source/cylindrical_epoch/epoch_axial/test/0000.sdf").variables
{'Wall-time': Constant(_id='elapsed_time', name='Wall-time', data=0.002371000000000012, units=None),
'Electric Field Modes/Exm/real': Variable(_id='exm_real', name='Electric Field Modes/Exm/real', dtype=dtype('float64'), shape=(500, 100, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='V/m', mult=1.0, grid='mode_grid', grid_mid='mode_grid_mid'),
'Electric Field Modes/Erm/real': Variable(_id='erm_real', name='Electric Field Modes/Erm/real', dtype=dtype('float64'), shape=(500, 100, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='V/m', mult=1.0, grid='mode_grid', grid_mid='mode_grid_mid'),
'Electric Field Modes/Etm/real': Variable(_id='etm_real', name='Electric Field Modes/Etm/real', dtype=dtype('float64'), shape=(500, 100, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='V/m', mult=1.0, grid='mode_grid', grid_mid='mode_grid_mid'),
'Electric Field Modes/Exm/imag': Variable(_id='exm_imag', name='Electric Field Modes/Exm/imag', dtype=dtype('float64'), shape=(500, 100, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='V/m', mult=1.0, grid='mode_grid', grid_mid='mode_grid_mid'),
'Electric Field Modes/Erm/imag': Variable(_id='erm_imag', name='Electric Field Modes/Erm/imag', dtype=dtype('float64'), shape=(500, 100, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='V/m', mult=1.0, grid='mode_grid', grid_mid='mode_grid_mid'),
'Electric Field Modes/Etm/imag': Variable(_id='etm_imag', name='Electric Field Modes/Etm/imag', dtype=dtype('float64'), shape=(500, 100, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='V/m', mult=1.0, grid='mode_grid', grid_mid='mode_grid_mid'),
'Magnetic Field Modes/Bxm/real': Variable(_id='bxm_real', name='Magnetic Field Modes/Bxm/real', dtype=dtype('float64'), shape=(500, 100, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='T', mult=1.0, grid='mode_grid', grid_mid='mode_grid_mid'),
'Magnetic Field Modes/Brm/real': Variable(_id='brm_real', name='Magnetic Field Modes/Brm/real', dtype=dtype('float64'), shape=(500, 100, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='T', mult=1.0, grid='mode_grid', grid_mid='mode_grid_mid'),
'Magnetic Field Modes/Btm/real': Variable(_id='btm_real', name='Magnetic Field Modes/Btm/real', dtype=dtype('float64'), shape=(500, 100, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='T', mult=1.0, grid='mode_grid', grid_mid='mode_grid_mid'),
'Magnetic Field Modes/Bxm/imag': Variable(_id='bxm_imag', name='Magnetic Field Modes/Bxm/imag', dtype=dtype('float64'), shape=(500, 100, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='T', mult=1.0, grid='mode_grid', grid_mid='mode_grid_mid'),
'Magnetic Field Modes/Brm/imag': Variable(_id='brm_imag', name='Magnetic Field Modes/Brm/imag', dtype=dtype('float64'), shape=(500, 100, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='T', mult=1.0, grid='mode_grid', grid_mid='mode_grid_mid'),
'Magnetic Field Modes/Btm/imag': Variable(_id='btm_imag', name='Magnetic Field Modes/Btm/imag', dtype=dtype('float64'), shape=(500, 100, 2), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='T', mult=1.0, grid='mode_grid', grid_mid='mode_grid_mid'),
'CPUs/Original rank': Variable(_id='cpu_rank', name='CPUs/Original rank', dtype=dtype('int32'), shape=(2, 4), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='CPU', mult=None, grid='grid_cpu_rank', grid_mid='grid_cpu_rank_mid'),
'CPUs/Current rank': Variable(_id='cpus_current', name='CPUs/Current rank', dtype=dtype('int32'), shape=(0, 0), is_point_data=False, sdffile=<sdf_xarray.sdf_interface.SDFFile object at 0x11d15da80>, units='CPU', mult=None, grid='grid_cpus_current', grid_mid='grid_cpus_current_mid')}
This leads to quite a difficult issue to deal with that is unique to CE's implementation. One of the flags I was considering using to check if the code being run is cylindrical was the code_name from the attributes but unfortunately this is set to "Epoch2d" so no different to the original EPOCH code when running in 2D....
Currently we don't support cylindrical EPOCH (CE). Upon running a preliminary test using the example deck
gaussian_pulse.deckit falls over when attempting to acquire the grid for a given variable.This is due to the
mode_gridnot existing in the list of gridsHowever all the variables in the file are using it
This leads to quite a difficult issue to deal with that is unique to CE's implementation. One of the flags I was considering using to check if the code being run is cylindrical was the
code_namefrom the attributes but unfortunately this is set to"Epoch2d"so no different to the original EPOCH code when running in 2D....