Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed style in templates #31

Merged
merged 4 commits into from
Dec 12, 2024
Merged
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
21 changes: 10 additions & 11 deletions src/hydrodiy/io/script_template_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@
# Select backend
mpl.use("Agg")

#----------------------------------------------------------------------
# ----------------------------------------------------------------------
# @Config
#----------------------------------------------------------------------

# ----------------------------------------------------------------------
parser = argparse.ArgumentParser(description="[DESCRIPTION]",
formatter_class=
argparse.ArgumentDefaultsHelpFormatter)
Expand Down Expand Up @@ -84,26 +83,26 @@
# Manage projection
#proj = pyproj.Proj("+init=EPSG:{0}".format(args.projection))
#
#----------------------------------------------------------------------
# ----------------------------------------------------------------------
# @Folders
#----------------------------------------------------------------------
# ----------------------------------------------------------------------
source_file = Path(__file__).resolve()

froot = [FROOT]
fdata = [FDATA]
fout = [FOUT]
fimg = [FIMG]

#------------------------------------------------------------
# ------------------------------------------------------------
# @Logging
#------------------------------------------------------------
# ------------------------------------------------------------
basename = source_file.stem
LOGGER = iutils.get_logger(basename)
LOGGER.log_dict(vars(args), "Command line arguments")

#------------------------------------------------------------
# ------------------------------------------------------------
# @Get data
#------------------------------------------------------------
# ------------------------------------------------------------
#fd = "%s/data.csv" % FDATA
#data, comment = csv.read_csv(fd)

Expand All @@ -112,9 +111,9 @@
mess = "{0} sites found".format(sites.shape[0])
LOGGER.info(mess)

#------------------------------------------------------------
# ------------------------------------------------------------
# @Plot
#------------------------------------------------------------
# ------------------------------------------------------------

# To use multipage pdf
#fpdf = fimg / "images.pdf"
Expand Down
27 changes: 15 additions & 12 deletions src/hydrodiy/io/script_template_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

[COMMENT]

import sys, os, re, json, math
import sys
import os
import re
import json
import math
import argparse
from pathlib import Path

Expand All @@ -23,13 +27,12 @@
#foo = importlib.util.module_from_spec(spec)
#spec.loader.exec_module(foo)

#----------------------------------------------------------------------
# ----------------------------------------------------------------------
# @Config
#----------------------------------------------------------------------
# ----------------------------------------------------------------------
parser = argparse.ArgumentParser(description="[DESCRIPTION]",
formatter_class=
argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument("-v", "--version",
help="Version number",
type=int, required=True)
Expand Down Expand Up @@ -58,27 +61,27 @@
debug = args.debug
sitepattern = args.sitepattern

#----------------------------------------------------------------------
# ----------------------------------------------------------------------
# @Folders
#----------------------------------------------------------------------
# ----------------------------------------------------------------------
source_file = Path(__file__).resolve()
froot = [FROOT]
fdata = [FDATA]
fout = [FOUT]
fimg = [FIMG]

#----------------------------------------------------------------------
# ----------------------------------------------------------------------
# @Logging
#----------------------------------------------------------------------
# ----------------------------------------------------------------------
basename = source_file.stem
flog = froot / "logs" / f"{basename}.log"
flog.parent.mkdir(exist_ok=True)
LOGGER = iutils.get_logger(basename, console=False, contextual=True)
LOGGER.log_dict(vars(args), "Command line arguments")

#----------------------------------------------------------------------
# ----------------------------------------------------------------------
# @Get data
#----------------------------------------------------------------------
# ----------------------------------------------------------------------
fs = fdata / "sites.csv"
allsites, _ = csv.read_csv(fs, index_col="siteid")

Expand All @@ -92,9 +95,9 @@
idx = iutils.get_ibatch(allsites.shape[0], nbatch, ibatch)
sites = allsites.iloc[idx, :]

#----------------------------------------------------------------------
# ----------------------------------------------------------------------
# @Process
#----------------------------------------------------------------------
# ----------------------------------------------------------------------
nsites = len(sites)
for isite, (siteid, sinfo) in enumerate(sites.iterrows()):

Expand Down
Loading