示例#1
0
 def process_lake_masks(self, lake_index: int, mask_files: xr.DataArray,
                        **kwargs) -> Optional[xr.DataArray]:
     from geoproc.surfaceMapping.lakeExtentMapping import WaterMapGenerator
     waterMapGenerator = WaterMapGenerator({
         'lake_index': lake_index,
         **self._defaults
     })
     return waterMapGenerator.process_yearly_lake_masks(
         lake_index, mask_files, **kwargs)
示例#2
0
from geoproc.surfaceMapping.lakeExtentMapping import WaterMapGenerator
import yaml, os

BASEDIR = os.path.dirname(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
opspec_file = os.path.join(BASEDIR, "specs", "lakes1.yml")

with open(opspec_file) as f:
    opspecs = yaml.load(f, Loader=yaml.FullLoader)
    waterMapGenerator = WaterMapGenerator(opspecs)
    waterMapGenerator.view_water_map_results("Lake1295")
示例#3
0
from geoproc.surfaceMapping.lakeExtentMapping import WaterMapGenerator
import yaml, os

BASEDIR = os.path.dirname(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
opspec_file = os.path.join(BASEDIR, "specs", "lakes1.yml")

with open(opspec_file) as f:
    opspecs = yaml.load(f, Loader=yaml.FullLoader)
    waterMapGenerator = WaterMapGenerator(opspecs)
    waterMapGenerator.view_water_map_results("MosulDamLake")
示例#4
0
from typing import List, Union, Tuple, Dict, Optional
from glob import glob
from geoproc.surfaceMapping.lakeExtentMapping import WaterMapGenerator
import os, time, collections

import yaml

lake_name = "MultiTileLake"  # "SingleTileLake" # ""MosulDamLake"  # "MultiTileLake"
CURDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DATA_DIR = '/Users/tpmaxwel/Dropbox/Tom/InnovationLab/results/Birkett'
opspec_file = os.path.join(CURDIR, "specs", "test_multi_tile.yml")
with open(opspec_file) as f:
    opspecs = yaml.load(f, Loader=yaml.FullLoader)
    waterMapGenerator = WaterMapGenerator(opspecs)
    waterMapGenerator.view_water_map_results(lake_name)
示例#5
0
from geoproc.plot.animation import SliceAnimation
from geoproc.surfaceMapping.lakeExtentMapping import WaterMapGenerator
import yaml, os

BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
opspec_file = os.path.join(BASEDIR, "specs", "lakes1.yml")
with open(opspec_file) as f:
    opspecs = yaml.load(f, Loader=yaml.FullLoader)
    waterMapGenerator = WaterMapGenerator(opspecs)
    patched_water_maps = waterMapGenerator.repatch_water_maps("Lake1295")
    roi = patched_water_maps.attrs.get("roi")
    kwargs = dict(overlays=dict(red=roi.boundary)) if (roi and not isinstance(roi, list)) else {}

    animation = SliceAnimation([waterMapGenerator.water_maps, patched_water_maps, waterMapGenerator.persistent_classes], **kwargs)
    animation.show()
示例#6
0
debug = False
temportal_interp = True
use_previous_patching = False
use_yearly_probabilities = True
view_water_masks = False
view_persistent_classes = False
view_interp_persistent_classes = True

with xr.set_options(keep_attrs=True):

    t0 = time.time()

    opspec = dict()

    waterMapGenerator = WaterMapGenerator()
    water_masks: xr.DataArray = waterMapGenerator.get_mpw_data(opspec)
    water_masks.attrs['cmap'] = dict(colors=colors4)
    lake_mask = water_masks.attrs[ "roi" ]

    if view_water_masks:
        animation = SliceAnimation( water_masks, overlays=dict(red=lake_mask.boundary) )
        animation.show()

    if use_previous_patching:
        repatched_water_maps: xr.DataArray = xr.open_dataset(f"{DATA_DIR}/SaltLake_patched_water_masks.nc").water_masks
        repatched_water_maps.attrs['cmap'] = dict(colors=colors4)

    else:
        if use_yearly_probabilities:
            water_probability_dataset = xr.open_dataset(f"{DATA_DIR}/SaltLake_yearly_water_probability.nc")