<commit_before>import os, sys
from datetime import datetime
from dateutil import parser
import psycopg2
import pandas as pd
import pandas.io.sql as psql
from matplotlib import pyplot as plt
import Image

###########################################################################
# Settings
dbhost = 'localhost'
#dbhost = 'clidesc.niwa.co.nz'

###########################################################################
# get the command line parameters
# we add some testing to the length of the passed parameters first
# that is in order to allow stand-alone non standard scripts to be developed
# (e.g. the ICU one ...)

if len(sys.argv) == 5:
    base_path = sys.argv[1] # base path is the path where the outputs, progress files and figures are saved
    stations = sys.argv[2] # list of stations, assumes string is passed, and comma is the separator
    from_date = parser.parse(sys.argv[3]) # from date: transform into a datetime object
    from_date = from_date.strftime('%Y-%m-%d') # and format correctly just in case the date wasnt entered YYYY-MM-DD
    to_date = parser.parse(sys.argv[4]) # to date: idem
    to_date = to_date.strftime('%Y-%m-%d')
    station_no = stations.split(',')[0] # assumes the first station is the 'primary' station

# Manage the progress file
progress_count = 0

###########################################################################
def clidesc_progress(base_path, percent):<commit_msg>added matplotlib.use('Agg') to clide.py<commit_after>import os, sys
from datetime import datetime
from dateutil import parser
import psycopg2
import pandas as pd
import pandas.io.sql as psql
from matplotlib import pyplot as plt
import Image

###########################################################################
# Settings
dbhost = 'localhost'
#dbhost = 'clidesc.niwa.co.nz'

###########################################################################
# get the command line parameters
# we add some testing to the length of the passed parameters first
# that is in order to allow stand-alone non standard scripts to be developed
# (e.g. the ICU one ...)

if len(sys.argv) == 5:
    base_path = sys.argv[1] # base path is the path where the outputs, progress files and figures are saved
    stations = str(sys.argv[2]) # list of stations, comma must be the separator
    from_date = parser.parse(sys.argv[3]) # from date: transform into a datetime object
    from_date = from_date.strftime('%Y-%m-%d') # and format correctly just in case the date wasnt entered YYYY-MM-DD
    to_date = parser.parse(sys.argv[4]) # to date: idem
    to_date = to_date.strftime('%Y-%m-%d')
    station_no = stations.split(',')[0] # assumes the first station is the 'primary' station

# Manage the progress file
progress_count = 0

###########################################################################
def clidesc_progress(base_path, percent):
{'fraction_non_alphanumeric': 0.23568435754189945, 'fraction_numerical': 0.00558659217877095, 'mean_word_length': 5.069915254237288, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3463771', 'n_tokens_mistral': 798, 'n_tokens_neox': 766, 'n_words': 296}