# -*- coding: utf-8 -*-
"""
Created on 2020-09-17 17:21

@author: a002028

"""
from bawsvis.session import Session
from bawsvis.readers.text import np_txt_reader
from bawsvis.plotting import PlotMap

if __name__ == "__main__":

    s = Session()

    lat = np_txt_reader('...N_FIX\\python_process_data\\lat_baws.txt')
    lon = np_txt_reader('...N_FIX\\python_process_data\\lon_baws.txt')

    # lat = np_txt_reader('E:\\Johannes_exjobb\\import_data\\lat_small.txt')
    # lon = np_txt_reader('E:\\Johannes_exjobb\\import_data\\lon_small.txt')

    # wd_data = 'E:\\Johannes_exjobb\\MODIS_data\\outdata\\monthly_seasonally_cummulative_and_FCA_data\\Cumulative\\annual\\Cumu_%s.txt'

    # for year in range(2019, 2021):
    #     year = str(year)
    #
    #     file = wd_data % year
    #     data = np_txt_reader(file)
    #
    #     map_frame = {'lat_min': 52., 'lat_max': 66.,
    #                  'lon_min': 7., 'lon_max': 37.5}
#     # aggregation is a numpy 2d-array
#     aggregation = raster_aggregation(generator)
#
#     # Export the aggragation in a tiff file.
#     # WARNING! tiff files only handles integer data with values <=100.
#     # The benefit of tiff-files are the super compressed format
#     s.export_data(data=aggregation,
#                   file_name='aggregation_2020.tiff',
#                   writer='raster')

if __name__ == "__main__":
    # Set path to data directory
    data_path = 'C:\\Temp\\baws_reanalys\\tiff_archive'

    # Create the Session object
    s = Session(data_path=data_path)

    # If we want to save data to a specific location, we set the export path here.
    # s.setting.set_export_directory(path=None)
    for year in range(2002, 2010):
        year = str(year)

        # Generate filepaths
        generator = generate_filepaths(s.data_path,
                                       pattern='cyano_daymap_' + year,
                                       endswith='.tiff',
                                       only_from_dir=True)

        # Loop through the file-generator and aggregate the data.
        # aggregation is a numpy 2d-array
        aggregation = raster_aggregation(generator)
Created on 2020-09-18 10:26

@author: a002028

"""
from bawsvis.utils import generate_filepaths
from bawsvis.session import Session
from bawsvis.data_handler import aggregation_annuals


if __name__ == "__main__":
    # Set path to data directory
    data_path = 'C:\\Utveckling\\BAWS-vis\\bawsvis\\export'

    # Create the Session object
    s = Session(data_path=data_path)

    # Generate filepaths
    generator = generate_filepaths(s.data_path,
                                   pattern='Cumu_',
                                   endswith='.txt',
                                   only_from_dir=True)

    # Loop through the file-generator and aggregate the data.
    # aggregation is a numpy 2d-array
    aggregation = aggregation_annuals(generator, reader='text')

    # Export the aggragation in a tiff file.
    # WARNING! tiff files only handles integer data with values <=100.
    # The benefit of tiff-files are the super compressed format
    s.export_data(data=aggregation,
示例#4
0
@author: a002028

"""
from bawsvis.utils import generate_filepaths
from bawsvis.session import Session
from bawsvis.readers.text import np_txt_reader
import numpy as np
import os

if __name__ == "__main__":
    # Set path to data directory
    data_path = '...N_FIX\\Result\\Cumu_annual_data'

    # Create the Session object
    s = Session(data_path=data_path)

    generator = generate_filepaths(s.data_path,
                                   pattern='Cumu_',
                                   endswith='.txt',
                                   only_from_dir=True)

    # If we want to save data to a specific location, we set the export path here.
    # s.setting.set_export_directory(path=None)
    for fid in generator:
        print(os.path.basename(fid))
        array = np_txt_reader(fid)

        array = np.where(array < 0, 0, array)

        s.export_data(data=array,
"""
Created on 2020-08-31 13:07

@author: a002028

"""
from bawsvis.utils import generate_filepaths, recursive_dict_update
from bawsvis.session import Session
from bawsvis.data_handler import get_daily_stats, get_weekly_stats

if __name__ == "__main__":
    # Set path to data directory
    data_path = '...\\Manuell_algtolkning'

    # Create the Session object
    s = Session(data_path=data_path)

    # If we want to save data to a specific location, we set the export path here.
    # s.setting.set_export_directory(path=None)

    # Generate filepaths (daily)
    generator = generate_filepaths(s.setting.export_directory,
                                   pattern='cyano_daymap_',
                                   endswith='.shp',
                                   only_from_dir=True)

    # Loop through the file-generator and aggregate the data.
    stats_daily = get_daily_stats(generator)

    # Generate filepaths (weekly)
    generator = generate_filepaths(s.data_path,
"""
Created on 2020-08-31 09:48

@author: a002028

"""
from bawsvis.utils import generate_filepaths
from bawsvis.session import Session
from bawsvis.data_handler import raster_aggregation

if __name__ == "__main__":
    # Set path to data directory
    data_path = 'E:\\Johannes_exjobb\\MODIS_data\\outdata\\attribute_data\\BAWS'

    # Create the Session object
    s = Session(data_path=data_path)

    # If we want to save data to a specific location, we set the export path here.
    # s.setting.set_export_directory(path=None)
    for year in range(2019, 2021):
        year = str(year)

        # Generate filepaths
        generator = generate_filepaths(s.data_path,
                                       pattern='BAWS_' + year,
                                       endswith='.txt',
                                       only_from_dir=False)

        # Loop through the file-generator and aggregate the data.
        # aggregation is a numpy 2d-array
        aggregation = raster_aggregation(generator, reader='text')
"""
Created on 2020-09-01 08:45

@author: a002028

"""
from bawsvis.utils import generate_filepaths
from bawsvis.session import Session
from bawsvis.data_handler import shapeify

if __name__ == "__main__":
    # Set path to data directory
    data_path = '...\\Manuell_algtolkning'

    # Create the Session object
    s = Session(data_path=data_path)

    # If we want to save data to a specific location, we set the export path here.
    # s.setting.set_export_directory(path=None)

    # Generate filepaths
    generator = generate_filepaths(s.data_path,
                                   pattern='cyano_daymap_',
                                   endswith='.tiff',
                                   only_from_dir=True)

    # Loop through the file-generator and shapeify raster data.
    # for rst_path in generator:
    #     print(rst_path)
    #     shapeify(rst_path, export_path=s.setting.export_directory)