Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 88 additions & 88 deletions Application.py
Original file line number Diff line number Diff line change
@@ -1,88 +1,88 @@
# -*- encoding: utf8 -*-
import cProfile
import datetime
import sys
import traceback

import line_profiler

from common.common import init
from common.profile_utils import profile_report, line_profile_report
from process.L2convertProcess import L2convertProcess
from regrid.abstract_regrid import AbstractRegrid
from regrid.tessellation import Tessellation


def parse_args():
"""
입력 파라미터를 파싱하는 메소드
:return: 파싱한 입력 파라미터 구조체
"""
if len(sys.argv) > 1:
yr = int(sys.argv[1])
mm = int(sys.argv[2])
dd = int(sys.argv[3])
hh = int(sys.argv[4])
dt = datetime.datetime(year=yr, month=mm, day=dd, hour=hh)
else:
dt = datetime.datetime.now(datetime.timezone.utc)
dt = datetime.datetime(year=dt.year, month=dt.month, day=dt.day, hour=dt.hour)

return dt


def main():
config, logger = init("config.yml")
logger.info("Start GEMS L3 Tessellation Process")

dt = parse_args()
# 실행 예 --> python Application.py 2022 01 06 00
# dt = datetime.datetime(2022,1,6,0,0,0) # for Test
logger.debug(f"Input Args. : {dt}")

startTime = datetime.datetime.now()

try:
worker = L2convertProcess(config)
worker.run(dt)
except:
logger.error(traceback.format_exc())

logger.debug("running time : {} s".format((datetime.datetime.now() - startTime).total_seconds()))
logger.info("Done GEMS L3 Tessellation Process")


def profile():
pr = cProfile.Profile(builtins=False)
pr.enable()
main()
pr.disable()

profile_report(pr.getstats())


def line_profile():
pr = line_profiler.LineProfiler()
pr.enable()
pr.add_function(L2convertProcess.run)
pr.add_function(L2convertProcess.write_product)
pr.add_function(Tessellation.execute)
pr.add_function(Tessellation._init_grid)
pr.add_function(AbstractRegrid.__init__)
# pr.add_function(BrowserProcess._l2_process)
# pr.add_function(BrowserProcess._apply_renderer)
# pr.add_function(BrowserProcess._add_accessory)
# pr.add_function(add_colorbar_v2)
# pr.add_function(compute_moving_average_exp)
# pr.add_function(get_geos_bbox)
# pr.add_function(MosaicProcess.Run)
main()
pr.disable()

line_profile_report(pr.get_stats())


if __name__ == '__main__':
# line_profile()
# profile()
main()
# -*- encoding: utf8 -*-
import cProfile
import datetime
import sys
import traceback
import line_profiler
from common.common import init
from common.profile_utils import profile_report, line_profile_report
from process.L2convertProcess import L2convertProcess
from regrid.abstract_regrid import AbstractRegrid
from regrid.tessellation import Tessellation
def parse_args():
"""
입력 파라미터를 파싱하는 메소드
:return: 파싱한 입력 파라미터 구조체
"""
if len(sys.argv) > 1:
yr = int(sys.argv[1])
mm = int(sys.argv[2])
dd = int(sys.argv[3])
hh = int(sys.argv[4])
dt = datetime.datetime(year=yr, month=mm, day=dd, hour=hh)
else:
dt = datetime.datetime.now(datetime.timezone.utc)
dt = datetime.datetime(year=dt.year, month=dt.month, day=dt.day, hour=dt.hour)
return dt
def main():
config, logger = init("config.yml")
logger.info("Start GEMS L3 Tessellation Process")
dt = parse_args()
# 실행 예 --> python Application.py 2022 01 06 00
# dt = datetime.datetime(2022,1,6,0,0,0) # for Test
logger.debug(f"Input Args. : {dt}")
startTime = datetime.datetime.now()
try:
worker = L2convertProcess(config)
worker.run(dt)
except:
logger.error(traceback.format_exc())
logger.debug("running time : {} s".format((datetime.datetime.now() - startTime).total_seconds()))
logger.info("Done GEMS L3 Tessellation Process")
def profile():
pr = cProfile.Profile(builtins=False)
pr.enable()
main()
pr.disable()
profile_report(pr.getstats())
def line_profile():
pr = line_profiler.LineProfiler()
pr.enable()
pr.add_function(L2convertProcess.run)
pr.add_function(L2convertProcess.write_product)
pr.add_function(Tessellation.execute)
pr.add_function(Tessellation._init_grid)
pr.add_function(AbstractRegrid.__init__)
# pr.add_function(BrowserProcess._l2_process)
# pr.add_function(BrowserProcess._apply_renderer)
# pr.add_function(BrowserProcess._add_accessory)
# pr.add_function(add_colorbar_v2)
# pr.add_function(compute_moving_average_exp)
# pr.add_function(get_geos_bbox)
# pr.add_function(MosaicProcess.Run)
main()
pr.disable()
line_profile_report(pr.get_stats())
if __name__ == '__main__':
# line_profile()
# profile()
main()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added OUTPUT/figure/00.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OUTPUT/figure/01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OUTPUT/figure/02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OUTPUT/figure/03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OUTPUT/figure/04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OUTPUT/figure/average.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OUTPUT/figure/idw_w_subgrid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OUTPUT/figure/idw_wo_subgrid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OUTPUT/figure/tessellation_w_subgrid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OUTPUT/figure/tessellation_wo_subgrid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 44 additions & 44 deletions avg_main.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
#-*- encoding: utf8 -*-
import argparse
import datetime
import traceback

from common.common import init
from process.average_process import AverageProcess


def parse_args():
"""
입력 파라미터를 파싱하는 메소드
:return: 파싱한 입력 파라미터 구조체
"""

parser = argparse.ArgumentParser()
parser.add_argument("-d", "--date", type=lambda s: datetime.datetime.strptime(s, '%Y%m%d'), required=True)
parser.add_argument("-m", "--mode", choices=["yearly", "monthly", "daily"], default="daily", required=True)
parser.add_argument("-t", "--target", choices=["NO2"], required=True)

options = parser.parse_args()

return options


def main():
config, logger = init("config.yml")
logger.info("Start GEMS L3 Average Process")

options = parse_args()

startTime = datetime.datetime.now()

try:
worker = AverageProcess(config)
worker.run(options.date, options.mode, options.target)
except:
logger.error(traceback.format_exc())

logger.debug("running time : {} s".format((datetime.datetime.now() - startTime).total_seconds()))
logger.info("Done GEMS L3 Average Process")

if __name__ == '__main__':
main()
#-*- encoding: utf8 -*-
import argparse
import datetime
import traceback
from common.common import init
from process.average_process import AverageProcess
def parse_args():
"""
입력 파라미터를 파싱하는 메소드
:return: 파싱한 입력 파라미터 구조체
"""
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--date", type=lambda s: datetime.datetime.strptime(s, '%Y%m%d'), required=True)
parser.add_argument("-m", "--mode", choices=["yearly", "monthly", "daily"], default="daily", required=True)
parser.add_argument("-t", "--target", choices=["NO2"], required=True)
options = parser.parse_args()
return options
def main():
config, logger = init("config.yml")
logger.info("Start GEMS L3 Average Process")
options = parse_args()
startTime = datetime.datetime.now()
try:
worker = AverageProcess(config)
worker.run(options.date, options.mode, options.target)
except:
logger.error(traceback.format_exc())
logger.debug("running time : {} s".format((datetime.datetime.now() - startTime).total_seconds()))
logger.info("Done GEMS L3 Average Process")
if __name__ == '__main__':
main()
Binary file added common/__pycache__/common.cpython-38.pyc
Binary file not shown.
Binary file added common/__pycache__/common.cpython-39.pyc
Binary file not shown.
Binary file added common/__pycache__/constant.cpython-38.pyc
Binary file not shown.
Binary file added common/__pycache__/constant.cpython-39.pyc
Binary file not shown.
Binary file added common/__pycache__/log.cpython-38.pyc
Binary file not shown.
Binary file added common/__pycache__/log.cpython-39.pyc
Binary file not shown.
Binary file added common/__pycache__/profile_utils.cpython-38.pyc
Binary file not shown.
Binary file added common/__pycache__/profile_utils.cpython-39.pyc
Binary file not shown.
24 changes: 12 additions & 12 deletions common/common.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import yaml
from common.log import init_logger

def init(path):
config = load_config(path)
logger = init_logger(config)

return config, logger

def load_config(path):
with open(path, 'r', encoding="utf-8") as f:
return yaml.load(f, Loader=yaml.FullLoader)
import yaml
from common.log import init_logger
def init(path):
config = load_config(path)
logger = init_logger(config)
return config, logger
def load_config(path):
with open(path, 'r', encoding="utf-8") as f:
return yaml.load(f, Loader=yaml.FullLoader)
4 changes: 2 additions & 2 deletions common/constant.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


GEMS_L2_FILENAME_PATTERN = "(?P<platform>GK2)_(?P<sensor>GEMS)_(?P<level>L2)_(?P<date>\d{8})_(?P<time>\d{4})_(?P<alg>.+)_(?P<area>.+)_(?P<binning>.+).nc"
Loading