How to use the omas.omas_utils.load_structure function in omas

To help you get started, we’ve selected a few omas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gafusion / omas / omas / omas_structure.py View on Github external
def extract_times(imas_version=omas_rcparams['default_imas_version']):
    '''
    return list of strings with .time across all structures

    :param imas_version: imas version

    :return: list with times
    '''
    from omas.omas_utils import list_structures
    from omas.omas_utils import load_structure

    omas_times = []
    for structure in list_structures(imas_version=imas_version):
        tmp = load_structure(structure, imas_version)[0]

        for item in tmp:
            if not item.endswith('.time') or 'data_type' not in tmp[item] or tmp[item]['data_type'] == 'structure':
                continue
            omas_times.append(item)

    return sorted(omas_times)
github gafusion / omas / omas / omas_structure.py View on Github external
cocos_mapper[".fact_dtheta"] = 'POL'
    cocos_mapper[".sigma_rphiz_eff"] = 'TOR'
    cocos_mapper["grid_type_transformation(index_grid_type,1)"] = '--delete--'
    cocos_mapper["grid_type_transformation(index_grid_type,2)"] = '--delete--'
    cocos_mapper["grid_type_transformation(index_grid_type,3)"] = '--delete--'
    cocos_mapper["grid_type_transformation(index_grid_type,4)"] = '--delete--'
    cocos_mapper[".fact_dim1*.fact_dim1"] = '--delete--'
    cocos_mapper[".fact_dim1*.fact_dim2"] = '--delete--'
    cocos_mapper[".fact_dim1*.fact_dim3"] = '--delete--'
    cocos_mapper[".fact_dim2*.fact_dim2"] = '--delete--'
    cocos_mapper[".fact_dim2*.fact_dim3"] = '--delete--'
    cocos_mapper[".fact_dim3*.fact_dim3"] = '--delete--'

    omas_cocos = {}
    for structure in list_structures(imas_version=imas_version):
        tmp = load_structure(structure, imas_version)[0]
        for item in tmp:
            if 'cocos_transformation_expression' in tmp[item]:
                cocos = tmp[item]['cocos_transformation_expression']
                cocos = cocos_mapper.get(cocos, cocos)
                if cocos != '--delete--':
                    omas_cocos[i2o(item)] = cocos

    return omas_cocos
github gafusion / omas / omas / omas_structure.py View on Github external
def extract_coordinates(imas_version=omas_rcparams['default_imas_version']):
    '''
    return list of strings with coordinates across all structures

    :param imas_version: imas version

    :return: list with coordinate
    '''
    from omas.omas_utils import list_structures
    from omas.omas_utils import load_structure

    omas_coordinates = set()
    for structure in list_structures(imas_version=imas_version):
        tmp = load_structure(structure, imas_version)[0]
        coords = []
        for item in tmp:
            if 'coordinates' in tmp[item]:
                coords.extend(map(i2o, tmp[item]['coordinates']))
        coords = list(filter(lambda x: '...' not in x, set(coords)))
        omas_coordinates.update(coords)

    return sorted(list(omas_coordinates))
github gafusion / omas / omas / omas_structure.py View on Github external
def extract_ggd(imas_version=omas_rcparams['default_imas_version']):
    '''
    return list of strings endingwith .ggd or .grids_ggd across all structures

    :param imas_version: imas version

    :return: list with times
    '''
    from omas.omas_utils import list_structures
    from omas.omas_utils import load_structure

    omas_ggd = []
    for structure in list_structures(imas_version=imas_version):
        tmp = load_structure(structure, imas_version)[0]

        for item in tmp:
            if item.endswith('.ggd') or item.endswith('.grids_ggd'):
                omas_ggd.append(item)

    return sorted(omas_ggd)