qgreenland/util/config.py
def _deref_boundaries(cfg):
    """Dereference project boundaries, modifying `cfg`.

    Replace project boundary value (filename) with an object containing
    useful information about the boundary file.
    """
    boundaries_config = cfg['project']['boundaries']
    for boundary_name, boundary_fn in boundaries_config.items():
        fp = os.path.join(LOCALDATA_DIR, boundary_fn)
        with fiona.open(fp) as ifile:
            features = list(ifile)
            meta = ifile.meta
            bbox = ifile.bounds

        if (feature_count := len(features)) != 1:
            raise exc.QgrInvalidConfigError(
                f'Configured boundary {boundary_name} contains the wrong'
                f' number of features. Expected 1, got {feature_count}.'
            )

        if (boundary_crs := meta['crs']['init'].lower()) \
           != (project_crs := cfg['project']['crs'].lower()):
            raise exc.QgrInvalidConfigError(
                f'Expected CRS of boundary file {fp} ({boundary_crs}) to'
                f' match project CRS ({project_crs}).'
            )

        boundaries_config[boundary_name] = {
            'fp': fp,
            'features': features,
            'bbox': bbox,
        }
Dereference project boundaries, modifying `cfg`.

    Replace project boundary value (filename) with an object containing
    useful information about the boundary file.
    
Dereference project boundaries, modifying `cfg`.
Replace project boundary value (filename) with an object containing
useful information about the boundary file.
Dereference project boundaries modifying ` cfg ` . Replace project boundary value ( filename ) with an object containing useful information about the boundary file .
def _deref_boundaries(cfg):
    boundaries_config = cfg['project']['boundaries']
    for boundary_name, boundary_fn in boundaries_config.items():
        fp = os.path.join(LOCALDATA_DIR, boundary_fn)
        with fiona.open(fp) as ifile:
            features = list(ifile)
            meta = ifile.meta
            bbox = ifile.bounds
        if (feature_count := len(features)) != 1:
            raise exc.QgrInvalidConfigError(
                f'Configured boundary {boundary_name} contains the wrong'
                f' number of features. Expected 1, got {feature_count}.'
            )
        if (boundary_crs := meta['crs']['init'].lower()) \
           != (project_crs := cfg['project']['crs'].lower()):
            raise exc.QgrInvalidConfigError(
                f'Expected CRS of boundary file {fp} ({boundary_crs}) to'
                f' match project CRS ({project_crs}).'
            )
        boundaries_config[boundary_name] = {
            'fp': fp,
            'features': features,
            'bbox': bbox,
        }
def _deref_boundaries ( cfg ) : boundaries_config = cfg [ 'project' ] [ 'boundaries' ] for boundary_name , boundary_fn in boundaries_config . items ( ) : fp = os . path . join ( LOCALDATA_DIR , boundary_fn ) with fiona . open ( fp ) as ifile : features = list ( ifile ) meta = ifile . meta bbox = ifile . bounds if ( feature_count := len ( features ) ) != 1 : raise exc . QgrInvalidConfigError ( f'Configured boundary {boundary_name} contains the wrong' f' number of features. Expected 1, got {feature_count}.' ) if ( boundary_crs := meta [ 'crs' ] [ 'init' ] . lower ( ) ) != ( project_crs := cfg [ 'project' ] [ 'crs' ] . lower ( ) ) : raise exc . QgrInvalidConfigError ( f'Expected CRS of boundary file {fp} ({boundary_crs}) to' f' match project CRS ({project_crs}).' ) boundaries_config [ boundary_name ] = { 'fp' : fp , 'features' : features , 'bbox' : bbox , }
Dereference project boundaries, modifying `cfg`.
Dereference project boundaries modifying ` cfg ` .
"""Dereference project boundaries, modifying `cfg`.

    Replace project boundary value (filename) with an object containing
    useful information about the boundary file.
    """
cfg