Commit 8976618f authored by Miguel Tremblay's avatar Miguel Tremblay
Browse files

QA/QC of the azimuth in the station file when the option --enable-sunshadow is used.

parent 9293f116
......@@ -123,6 +123,11 @@ class Metro_data:
for i in range(0,len(self.lMatrix_col_name)):
self.lMatrix_col_usage.append([i])
def __str__( self ):
header = "===============================BEGIN Metro_data object==============================="
footer = "================================END Metro_data object================================"
return "\n%s\nread only=%s\ndHeader=%s\nColumn name=%s\nColumn index=%s\nMatrix=\n%s\n%s\n" % \
(header,self.bRead_only,self.dHeader,self.lMatrix_col_name,self.lMatrix_col_usage,self.npMatrix,footer)
def set_readonly( self, bIs_read_only ):
"""
......@@ -477,7 +482,7 @@ class Metro_data:
else:
return self.lMatrix_col_usage[-1][-1] + 1
def del_matrix_row(self, npIndiceToRemove):
"""
Delete one or more row identified by indices.
......@@ -526,3 +531,4 @@ class Metro_data:
npMatrix = self.__append_row_to_matrix(npMatrix, npCol)
npMatrix = npMatrix.transpose()
return npMatrix
#
# METRo : Model of the Environment and Temperature of Roads
# METRo is Free and is proudly provided by the Government of Canada
# Copyright (C) Her Majesty The Queen in Right of Canada, Environment Canada, 2006
# Questions or bugs report: metro@ec.gc.ca
# METRo repository: https://gna.org/projects/metro/
# Documentation: http://documentation.wikia.com/wiki/METRo
#
#
# Code contributed by:
# Miguel Tremblay - Canadian meteorological center
# Francois Fortin - Canadian meteorological center
#
# $LastChangedDate$
# $LastChangedRevision$
#
########################################################################
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
#
"""
Name: Metro_preprocess_qa_qc_station
Description: QA and QC for the station file is made here.
Notes:
Auteur: Miguel Tremblay
Date: September 30 2014
"""
from metro_preprocess import Metro_preprocess
import numpy
import fpconst
import metro_config
import metro_logger
import metro_error
from toolbox import metro_constant
from toolbox import metro_date
from toolbox import metro_util
_ = metro_util.init_translation('metro_preprocess_qa_qc_station')
class Metro_preprocess_qa_qc_station(Metro_preprocess):
def start(self):
Metro_preprocess.start(self)
try:
Metro_preprocess.start(self)
pStation = self.get_infdata_reference('STATION')
if self.infdata_exist('HORIZON'):
self.__check_sunshadow(pStation)
except metro_error.Metro_data_error, inst:
metro_logger.print_message(metro_logger.LOGGER_MSG_STOP,\
str(inst))
def __check_sunshadow(self, station_data):
"""
Check if all the condidations for the sun-shadow algorithm are met.
1- Presence of the data in station config file;
2- The last value of the azimuth is 360.
"""
pHorizon = self.get_infdata_reference('HORIZON')
horizon_data = pHorizon.get_data()
# Is there the <azimuth> data in the station file?
if horizon_data == None:
sMessage = _("Option --enable-sunshadow is given but there is no ") +\
_("azimuth data in station configuration file.\n ") +\
_("Please correct this or remove the option --enable-sunshadow")
metro_logger.print_message(metro_logger.LOGGER_MSG_STOP,\
sMessage).Metro_util_error(sMessage)
npAzim = horizon_data.get_matrix_col('AZIMUTH')
npElev = horizon_data.get_matrix_col('ELEVATION')
# Verification if the array has an monotone and regular incrementation steps
if not metro_util.is_array_uniform(npAzim):
sMessage = _("Azimuth data in station configuration file ") +\
_("is not ordered by equal growing azimuths.\n ")+\
_("Please correct this or remove the option --enable-sunshadow")
metro_logger.print_message(metro_logger.LOGGER_MSG_STOP,\
sMessage).Metro_util_error(sMessage)
# Check if the first item is zero degree and the last 360
if npAzim[0] != 0 and npAzim[-1] != 360:
sMessage = _("Azimuth data does not have a value at 0 and/or 360 degrees. ") +\
_("Please add one of this value to have a complete horizon.\n ")
metro_logger.print_message(metro_logger.LOGGER_MSG_STOP,\
sMessage).Metro_util_error(sMessage)
elif npAzim[0] == 0 and npAzim[-1] != 360:
horizon_data.append_matrix_row([360.0,npElev[0]]);
......@@ -1185,6 +1185,7 @@ def set_default_value( ):
"metro_string2dom_station",
"metro_dom2metro",
"metro_preprocess_validate_input",
"metro_preprocess_qa_qc_station",
"metro_preprocess_qa_qc_forecast",
"metro_preprocess_interpol_forecast",
"metro_preprocess_fsint2",
......
# English translations for PACKAGE package.
# Copyright (C) 2014 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# Miguel Tremblay <miguel.tremblay@ec.gc.ca>, 2014.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-16 19:45+0000\n"
"PO-Revision-Date: 2014-10-16 19:57+0000\n"
"Last-Translator: Miguel Tremblay <miguel.tremblay@ec.gc.ca>\n"
"Language-Team: English\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ASCII\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: executable_module/metro_preprocess_qa_qc_station.py:87
msgid "Option --enable-sunshadow is given but there is no "
msgstr "Option --enable-sunshadow is given but there is no "
#: executable_module/metro_preprocess_qa_qc_station.py:88
msgid ""
"azimuth data in station configuration file.\n"
" "
msgstr ""
"azimuth data in station configuration file.\n"
" "
#: executable_module/metro_preprocess_qa_qc_station.py:89
#: executable_module/metro_preprocess_qa_qc_station.py:101
msgid "Please correct this or remove the option --enable-sunshadow"
msgstr "Please correct this or remove the option --enable-sunshadow"
#: executable_module/metro_preprocess_qa_qc_station.py:99
msgid "Azimuth data in station configuration file "
msgstr "Azimuth data in station configuration file "
#: executable_module/metro_preprocess_qa_qc_station.py:100
msgid ""
"is not ordered by equal growing azimuths.\n"
" "
msgstr ""
"is not ordered by equal growing azimuths.\n"
" "
#: executable_module/metro_preprocess_qa_qc_station.py:108
msgid "Azimuth data does not have a value at 0 and/or 360 degrees. "
msgstr "Azimuth data does not have a value at 0 and/or 360 degrees. "
#: executable_module/metro_preprocess_qa_qc_station.py:109
msgid ""
"Please add one of this value to have a complete horizon.\n"
" "
msgstr ""
"Please add one of this value to have a complete horizon.\n"
" "
# French translations for PACKAGE package.
# Copyright (C) 2014 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Miguel Tremblay <miguel.tremblay@ec.gc.ca>, 2014.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-16 19:45+0000\n"
"PO-Revision-Date: 2014-10-16 19:56+0000\n"
"Last-Translator: \n"
"Language-Team: American English <kde-i18n-doc@kde.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Lokalize 1.4\n"
#: executable_module/metro_preprocess_qa_qc_station.py:87
msgid "Option --enable-sunshadow is given but there is no "
msgstr "Option --enable-sunshadow est indiqué mais il n'y a pas "
#: executable_module/metro_preprocess_qa_qc_station.py:88
msgid ""
"azimuth data in station configuration file.\n"
" "
msgstr "de données d'azimuth dans le fichier de configuration de la station.\n"
#: executable_module/metro_preprocess_qa_qc_station.py:89
#: executable_module/metro_preprocess_qa_qc_station.py:101
msgid "Please correct this or remove the option --enable-sunshadow"
msgstr "Svp corriger ce problème ou retirer l'option --enable-sunshadow"
#: executable_module/metro_preprocess_qa_qc_station.py:99
msgid "Azimuth data in station configuration file "
msgstr "Les données d'azimuth dans le fichier de configuration "
#: executable_module/metro_preprocess_qa_qc_station.py:100
msgid ""
"is not ordered by equal growing azimuths.\n"
" "
msgstr "ne sont pas en ordre croissant et égales.\n"
#: executable_module/metro_preprocess_qa_qc_station.py:108
msgid "Azimuth data does not have a value at 0 and/or 360 degrees. "
msgstr "Les données d'azimuth n'ont pas de valeur à 0 et/ou 360 degrées. "
#: executable_module/metro_preprocess_qa_qc_station.py:109
msgid ""
"Please add one of this value to have a complete horizon.\n"
" "
msgstr "Svp ajoute une de ces valeurs pour compléter l'horizon.\n"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment