Пример #1
0
def process_vci_2018():

    processor = VHIPreprocessor(get_data_path(), "VCI")

    processor.preprocess(subset_str="kenya",
                         resample_time="M",
                         upsampling=False)
Пример #2
0
def process_vci(subset_str: str = "kenya"):
    data_path = get_data_path()
    processor = VHIPreprocessor(get_data_path(), "VCI")
    regrid_path = (
        data_path /
        f"interim/reanalysis-era5-land_preprocessed/data_{subset_str}.nc")
    assert regrid_path.exists(), f"{regrid_path} not available"

    processor.preprocess(subset_str=subset_str,
                         resample_time="M",
                         upsampling=False,
                         regrid=regrid_path)
Пример #3
0
def process_vci_2018():
    # if the working directory is alread ml_drought don't need ../data
    if Path('.').absolute().as_posix().split('/')[-1] == 'ml_drought':
        data_path = Path('data')
    else:
        data_path = Path('../data')

    processor = VHIPreprocessor(data_path, 'VCI')

    processor.preprocess(subset_str='kenya',
                         resample_time='M',
                         upsampling=False)
def preprocess_data(data_path):
    # preprocess VHI
    print('** Preprocessing VHI **')
    processor = VHIPreprocessor(data_path)
    processor.preprocess(
        subset_str='kenya', regrid=regrid_path,
         n_parallel_processes=1, resample_time='M',
         upsampling=False
    )

    regrid_path = data_path / 'interim' / 'vhi_preprocessed' / 'vhi_kenya.nc'

    # preprocess CHIRPS Rainfall
    print('** Preprocessing CHIRPS Precipitation **')
    processor = CHIRPSPreprocesser(data_path)
    processor.preprocess(
        subset_str='kenya', regrid=regrid_path,
        n_parallel_processes=1
    )

    # preprocess GLEAM evaporation
    print('** Preprocessing GLEAM Evaporation **')
    processor = GLEAMPreprocessor(data_path)
    processor.preprocess(
        subset_str='kenya', regrid=regrid_path,
        resample_time='M', upsampling=False
    )

    # preprocess SRTM Topography
    print('** Preprocessing SRTM Topography **')
    processor = SRTMPreprocessor(data_path)
    processor.preprocess(
        subset_str='kenya', regrid=regrid_path
    )

    # preprocess ESA CCI Landcover
    print('** Preprocessing ESA CCI Landcover **')
    processor = ESACCIPreprocessor(data_path)
    processor.preprocess(
        subset_str='kenya', regrid=regrid_path,
        resample_time='M', upsampling=False
    )
Пример #5
0
def preprocess_data(data_path):
    # preprocess VHI
    print("** Preprocessing VHI **")
    processor = VHIPreprocessor(data_path)
    processor.preprocess(
        subset_str="kenya",
        regrid=regrid_path,
        n_parallel_processes=1,
        resample_time="M",
        upsampling=False,
    )

    regrid_path = data_path / "interim" / "vhi_preprocessed" / "vhi_kenya.nc"

    # preprocess CHIRPS Rainfall
    print("** Preprocessing CHIRPS Precipitation **")
    processor = CHIRPSPreprocessor(data_path)
    processor.preprocess(subset_str="kenya",
                         regrid=regrid_path,
                         n_parallel_processes=1)

    # preprocess GLEAM evaporation
    print("** Preprocessing GLEAM Evaporation **")
    processor = GLEAMPreprocessor(data_path)
    processor.preprocess(subset_str="kenya",
                         regrid=regrid_path,
                         resample_time="M",
                         upsampling=False)

    # preprocess SRTM Topography
    print("** Preprocessing SRTM Topography **")
    processor = SRTMPreprocessor(data_path)
    processor.preprocess(subset_str="kenya", regrid=regrid_path)

    # preprocess ESA CCI Landcover
    print("** Preprocessing ESA CCI Landcover **")
    processor = ESACCIPreprocessor(data_path)
    processor.preprocess(subset_str="kenya",
                         regrid=regrid_path,
                         resample_time="M",
                         upsampling=False)
Пример #6
0
from pathlib import Path

# from src.preprocess.vhi import VHIPreprocesser
from src.preprocess import VHIPreprocessor

data_dir = Path('/scratch/chri4118/data/')

v = VHIPreprocessor(data_folder=data_dir)
v.preprocess(
    subset_str='ethiopia',
    regrid=None,
    parallel=True,
    resample_time = None
)

# wait
import salem
%matplotlib
ds = xr.open_dataset(data_dir)
ds.VHI.salem.quick_map()
Пример #7
0
from src.api_helpers import Region
from src.preprocess import VHIPreprocessor

ea_region = Region(
    name='ea_region',
    lonmin=21,
    lonmax=51.8,
    latmin=-11,
    latmax=23,
)

data_dir = Path('/scratch/data/')

v = VHIPreprocessor(data_folder=data_dir)
v.preprocess(subset_kenya=False)
"""
# L64
(
# 5. chop out EastAfrica
if subset_kenya:
    kenya_region = get_kenya()
    new_ds = select_bounding_box(new_ds, kenya_region)
)
### =>
(
region = ea_region
new_ds = select_bounding_box(new_ds, region)
)
"""