metro_config.py 44.6 KB
Newer Older
1
2
3
4
# -*- coding: UTF8 -*-
#
# METRo : Model of the Environment and Temperature of Roads
# METRo is Free and is proudly provided by the Government of Canada
Miguel Tremblay's avatar
Miguel Tremblay committed
5
# Copyright (C) Her Majesty The Queen in Right of Canada, Environment Canada, 2006
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

#  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
#
#
#


Miguel Tremblay's avatar
Miguel Tremblay committed
38
"""
Miguel Tremblay's avatar
Miguel Tremblay committed
39
Name:        metro_config
Miguel Tremblay's avatar
Miguel Tremblay committed
40
41
42
43
44
45
46
47
48
Author:      Francois Fortin
Date:        30/03/2004

Description: Module that centralize all the metro configuration.
             Configuration is saved in a dictionnary of dictionnaries.

"""


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
import sys
import getopt

import metro_logger
from toolbox import metro_config_validation
from toolbox import metro_xml
from toolbox import metro_xml_dtd
from toolbox import metro_util
from external_lib.Plist_config import plist_writer
from external_lib.Plist_config import plist_reader

_ = metro_util.init_translation('metro_config')




Miguel Tremblay's avatar
Miguel Tremblay committed
66
# Configuration for translation of messages in diffenrent languages
67
68
69
METRO_CONFIG_GETTEXT_PACKAGE  = "metro_config"
METRO_CONFIG_GETTEXT_LOCALEDIR = "./locale"

Miguel Tremblay's avatar
Miguel Tremblay committed
70
# Constant definition 
71
72
CFG_METRO_VERSION="3.3.0"
CFG_METRO_DATE="2015-03-10"
73
74


Miguel Tremblay's avatar
Miguel Tremblay committed
75
76
77
78
79
80
# Origin of the value (command line, config file, hardcoded value,
#                       metro internal constant)
# NB: 1. The command line overwrite the config file. Config file overwrite
#          hardcoded value.
#     2. We should not redefine metro internal constant in a config file nor
#         in command line.
81
82
83
84
85
86
87
88
89
90
CFG_INTERNAL    = 0
CFG_HARDCODED   = 1
CFG_CONFIGFILE  = 2
CFG_COMMANDLINE = 3

CFG_SHORT_OPTIONS = "ho:v:c:l:"
CFG_LONG_OPTIONS  = ["help","version",
                     "input-observation-ref=",
                     "input-forecast=", "input-observation=",
                     "input-station=", 
91
                     "output-roadcast=",
92
93
94
                     "bypass-core",
                     "generate-dtd-catalog",
                     "config=","generate-config=","log-file=","verbose-level=",
95
                     "selftest", "silent", "roadcast-start-date=", "lang=",
96
                     "use-solarflux-forecast", "use-infrared-forecast",
97
                     "use-anthropogenic-flux",
98
                     "use-sst-sensor-depth",
99
100
                     "enable-sunshadow",
                     "sunshadow-method=",
101
102
                     "output-subsurface-levels",
                     "fix-deep-soil-temperature="
103
                     ]
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171



dConfig = {}

def read_config_file( sFilename ):

    try:
        sConfig_file = open(sFilename).read()
    except IOError, sError:
        dConf = {}

        sIOError =  _("Cant open METRo configuration file:'%s' test\n") \
                   % (sFilename) +\
                   _("The following error occured:\n%s") % (sError)

        metro_logger.print_init_message(metro_logger.LOGGER_INIT_ERROR,
                                        sIOError)

        sys.exit(2)        
    else:
                
        plreader = plist_reader.Plist_reader()
        try: 
            dConf = plreader.read(sConfig_file)
        except:
            dConf = {}
            sError = _("Error when reading METRo configuration\n") + \
                     _("file:'%s'. Please make sure that the file\nhave ") % (sFilename)+ \
                     _("valid XML synthax and is not corrupted. You can ") + \
                     _("check it with the command 'xmllint %s'. You can\n") % (sFilename)+ \
                     _("also generated a new one with the option: %s.\n") \
                     % ("--generate-config",)
            metro_logger.print_init_message(metro_logger.LOGGER_INIT_ERROR,
                                            sError)
            sys.exit(2)
        else:
            sSuccess = _("Configuration file:'%s' loaded with success") \
                       % (sFilename)
            metro_logger.print_init_message(metro_logger.LOGGER_INIT_SUCCESS,
                                            sSuccess)

    return dConf

def write_config_file( sFilename, bFull_config=False ):
    plwriter = plist_writer.Plist_writer()
    try:
        plwriter.write(sFilename,dConfig,True,bFull_config)
    except IOError, sError:
        sError =  _("Unable to write to file '%s', the following\n") %(sFilename)+ \
                  _("error occured: %s") % (sError)
        metro_logger.print_init_message(metro_logger.LOGGER_INIT_ERROR,
                                        sError)
        sys.exit(2)

def overlay_config( dBase, dNew, iConfig_level ):

    for sKey in dNew.keys():
        if sKey in dBase:
            dBase[sKey]['VALUE'] = dNew[sKey]
            dBase[sKey]['FROM']  = iConfig_level
        else:
            sMessage = _("Additionnal configuration value added to METRo config.")
            sComments = "'%s', %s" % (sKey,sMessage)
            dBase[sKey] = {'VALUE'   :dNew[sKey],
                           'FROM'    :iConfig_level,
                           'COMMENTS':sMessage}

Miguel Tremblay's avatar
Miguel Tremblay committed
172
173
            sWarning = _("%s\nkey='%s'\nvalue='%s'") %\
                       (sMessage, sKey, dNew[sKey])
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
            metro_logger.print_init_message(metro_logger.LOGGER_INIT_SUCCESS,
                                            sWarning)



def init( ):
    set_default_value()

def get_cmdline_conf( lArgs ):
    return save_command_line_parameter(lArgs[1:],
                                       CFG_SHORT_OPTIONS,
                                       CFG_LONG_OPTIONS)

def process_command_line_parameter( dCmdline ):

    # si l'usager desire generer un fichier de configuration
    if 'FILE_GENERATE_CONFIGMETRO' in dCmdline:
        sConfig_filename = dCmdline['FILE_GENERATE_CONFIGMETRO']

        sGenerate = _("Generating METRo configuration file...")
        metro_logger.print_init_message(metro_logger.LOGGER_INIT_MESSAGE,
                                        sGenerate)
        write_config_file(sConfig_filename)
        sSuccess = _("METRo configuration file '%s' created with \n") \
                     % (sConfig_filename) + \
                   _("success. To launch METRo with that configuration\n") + \
                   _("file you need to use the --config option\n") 

        metro_logger.print_init_message(metro_logger.LOGGER_INIT_SUCCESS,
                                        sSuccess)
        sys.exit(0)

def read_configuration_file( dCmdline_conf ):
    if 'FILE_CONFIGMETRO_FILENAME' in dCmdline_conf:
        sConfig_filename = dCmdline_conf['FILE_CONFIGMETRO_FILENAME']
        sMessage = _("Reading and validating configuration file...")
        metro_logger.print_init_message(metro_logger.LOGGER_INIT_MESSAGE,
                                        sMessage)
        dConfigfile = read_config_file(sConfig_filename)

    else:
        dConfigfile = None

    return dConfigfile

def overlay_configuration( dFile_conf, dCmdline_conf ):
    if dFile_conf != None:
        overlay_config(dConfig, dFile_conf, CFG_CONFIGFILE)

    if dCmdline_conf != None:
        # Ajoute les valeurs passe sur la ligne de commande
        overlay_config(dConfig, dCmdline_conf, CFG_COMMANDLINE)

def validating_configuration( ):
    # validation de toute les options
    sMessage = _("Validating configuration")
    metro_logger.print_init_message(metro_logger.LOGGER_INIT_MESSAGE,
                                    sMessage)
    
233
    metro_config_validation.validate_config(dConfig)
234
235
236
237

    metro_logger.print_init_message(metro_logger.LOGGER_INIT_SUCCESS,
                                    _("METRo configuration validated"))

Miguel Tremblay's avatar
Miguel Tremblay committed
238

239
def get_value( sKey ):
Miguel Tremblay's avatar
Miguel Tremblay committed
240
241
242
243
244
245
246
247
248
    """
    Description: Get the information in the configuration correspoding to sKey

    Parameters:
    sKey (string): key representating the value to extract from the
    configuration dictionnary.

    Return the value (undefined type) of the dictionnary for sKey.
    """
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264

    return dConfig[sKey]['VALUE']

def set_value( sKey, value ):
    dConfig[sKey]['VALUE'] = value


def get_comment( sKey ):
    return dConfig[sKey]['COMMENTS']

def key_exist( sKey ):
    return sKey in dConfig



def get_metro_version( ):
Miguel Tremblay's avatar
Miguel Tremblay committed
265
266
267
268
269
270
271
    """
    Name:          get_metro_version
    Parameters:   None
    Output:     string: version number
    Descriptions: Get the version of METRo
    """
    
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
    return CFG_METRO_VERSION + " (" + CFG_METRO_DATE + ")" 

def save_command_line_parameter( lArgv, sShort_opt, lLong_opt ):

    dConf = {}

    try:
        opts, args = getopt.gnu_getopt( lArgv, sShort_opt, lLong_opt)

    except getopt.GetoptError, sError:
        # print help information and exit:
        sMessage = _("bad arg: ") + str(sError)
        print sMessage
        sys.exit(2)

    if args != []:
        sMessage = _("problem with arg: ") + str(args) +\
289
                   _("\nString(s) was not recognized as an argument.")
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
        print sMessage
        sys.exit(3)
    
    output = None
    verbose = False
    for o, a in opts:
        if o in ("-v", "--verbose-level"):
            if a == "0":
                dConf['INIT_LOGGER_VERBOSE_LEVEL'] = \
                    metro_logger.LOGGER_VERBOSE_LEVEL_NOLOG
            elif a == "1":
                dConf['INIT_LOGGER_VERBOSE_LEVEL'] = \
                    metro_logger.LOGGER_VERBOSE_LEVEL_MINIMAL
            elif a == "2":
                dConf['INIT_LOGGER_VERBOSE_LEVEL'] = \
                    metro_logger.LOGGER_VERBOSE_LEVEL_NORMAL
            elif a == "3":
                dConf['INIT_LOGGER_VERBOSE_LEVEL'] = \
                    metro_logger.LOGGER_VERBOSE_LEVEL_FULL
            elif a == "4":
                dConf['INIT_LOGGER_VERBOSE_LEVEL'] = \
                    metro_logger.LOGGER_VERBOSE_LEVEL_DEBUG
            else:
                sError = _("%s is not a valid value for %s. Please use ") %\
                         (a,o)+ \
                         _("one of the\nfollowing: 0, 1 , 2, 3, 4. High ") + \
                         _("value mean higher verbosity")
                metro_logger.print_init_message(metro_logger.LOGGER_INIT_ERROR,
                                                sError)
                sys.exit(3)
               
        if o in ("-l", "--log-file"):
            dConf['FILE_LOGGER_FILENAME'] = a

        if o in ("-c", "--config"):
            dConf['FILE_CONFIGMETRO_FILENAME'] = a

        if o == "--generate-config":
            dConf['FILE_GENERATE_CONFIGMETRO'] = a

        if o == "--generate-dtd-catalog":
            metro_xml_dtd.generate_dtd_catalog()
            sys.exit(0)

        if o == "--bypass-core":
            dConf['T_BYPASS_CORE'] = True

        if o in ("-h", "--help"):
            sMetro_root_path = metro_util.get_metro_root_path()
François Fortin's avatar
François Fortin committed
339
            sMetro_man_path = sMetro_root_path + "/usr/share/man/man1/metro.1"
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
            print _("see man page: 'man %s'") % sMetro_man_path
            sys.exit()

        if o == "--version":
            print "METRo version: ",get_metro_version()
            sys.exit(0)

        if o in ("-o", "--output"):
            print "output"
            output = a

        if o == "--roadcast-start-date":
            dConf['INIT_ROADCAST_START_DATE'] = a

        if o == "--input-forecast":
            dConf['FILE_FORECAST_IN_FILENAME'] = a

        if o == "--input-observation":
            dConf['FILE_OBSERVATION_FILENAME'] = a

        if o == "--input-observation-ref":
            dConf['FILE_OBSERVATION_REF_FILENAME'] = a

        if o == "--input-station":
            dConf['FILE_STATION_FILENAME'] = a

        if o == "--output-roadcast":
            dConf['FILE_ROADCAST_FILENAME'] = a

369
370
371
372
        if o == "--use-infrared-forecast":
            dConfig['IR']['VALUE'] = True
            # Add extended item based on options in command line.
            dIRDict = {'NAME':"IR",
373
                       'XML_TAG':"ir",
374
375
376
377
378
379
380
381
382
383
384
                       'DATA_TYPE':"REAL"}
            dConfig['XML_FORECAST_PREDICTION_EXTENDED_ITEMS'][\
            'VALUE'].append(dIRDict)

        if o == "--use-solarflux-forecast":
            dConfig['SF']['VALUE'] = True
            dSFDict= {'NAME':"SF",
                      'XML_TAG':"sf",
                      'DATA_TYPE':"REAL"}
            dConfig['XML_FORECAST_PREDICTION_EXTENDED_ITEMS'][\
            'VALUE'].append(dSFDict)
385

386
387
        if o == "--use-anthropogenic-flux":
            dConfig['FA']['VALUE'] = True
388
            dFADict= {'NAME':"FA",
389
390
391
                      'XML_TAG':"fa",
                      'DATA_TYPE':"REAL"}
            dConfig['XML_FORECAST_PREDICTION_EXTENDED_ITEMS'][\
392
393
394
395
396
397
398
399
400
            'VALUE'].append(dFADict)

        if o == "--use-sst-sensor-depth":
            dConfig['SST_DEPTH']['VALUE'] = True
            dSST_DEPTHDict = {'NAME':"SST_DEPTH",
                              'XML_TAG':"sst-sensor-depth",
                              'DATA_TYPE':"REAL"}
            dConfig['XML_STATION_HEADER_EXTENDED_ITEMS'][\
            'VALUE'].append(dSST_DEPTHDict)
401

402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431

        if o == "--enable-sunshadow":
            dConfig['SUNSHADOW']['VALUE'] = True
            dConfig['XML_STATION_XPATH_HORIZON'] = \
                {'VALUE'   :"/station/visible-horizon/direction",
                 'FROM'    :CFG_INTERNAL,
                 'COMMENTS':_("xpath path for station visible horizon")}
            dConfig['XML_STATION_HORIZON_STANDARD_ITEMS'] = \
                {'VALUE' :[{'NAME':"AZIMUTH",
                            'XML_TAG':"azimuth",
                            'DATA_TYPE':"REAL"}, 
                           {'NAME':"ELEVATION", 
                            'XML_TAG':"elevation",
                            'DATA_TYPE':"REAL"} 
                          ],
                 'FROM'     :CFG_INTERNAL,
                 'COMMENTS' :_("standard visible horizon items")}
            dConfig['XML_STATION_HORIZON_EXTENDED_ITEMS'] = \
                {'VALUE'    :[],
                 'FROM'     :CFG_INTERNAL,
                 'COMMENTS' :_("extended visible horizon items")}
        
	if o == "--sunshadow-method":
            try:
                dConfig['SUNSHADOW_METHOD']['VALUE'] = int(a)
	    except:
	    	# Use default sunshadow method (=1)
	        pass


432
433
434
435
436
437
        if o == "--fix-deep-soil-temperature":
            try:
                dConfig['DEEP_SOIL_TEMP']['VALUE'] = True
                dConfig['DEEP_SOIL_TEMP_VALUE']['VALUE'] = a
            except:
                pass
438

439
        if o == "--output-subsurface-levels":
440
            dConfig['TL']['VALUE'] = True
441
442
443
444
445
446
447
448
449
450

            dVlHeader = {'NAME':"VERTICAL_LEVELS",
                         'XML_TAG':"vertical-levels",
                         'DATA_TYPE':"VERTICAL_LEVELS"}
            dConfig['XML_ROADCAST_HEADER_EXTENDED_ITEMS'][\
            'VALUE'].append(dVlHeader)
            
            dTL= {'NAME':"TL",
                  'XML_TAG':"tl",
                  'DATA_TYPE':"LIST_LEVEL_TEMP"}
451
            dConfig['XML_ROADCAST_PREDICTION_EXTENDED_ITEMS'][\
452
453
454
            'VALUE'].append(dTL)


455
            
456

457
        # Selftest value
458
        if o == "--selftest":
459
            
460
            opts.append(("--output-subsurface-levels",""))
461
                        
462
463
464
465
            dConf['INIT_ROADCAST_START_DATE'] = "2004-01-30T20:00Z"

            dConf['FILE_FORECAST_IN_FILENAME'] = \
                metro_util.get_metro_root_path() +\
466
                "/usr/share/metro/data/selftest/forecast.xml"
467
468
            dConf['FILE_OBSERVATION_FILENAME'] = \
                metro_util.get_metro_root_path() +\
469
                "/usr/share/metro/data/selftest/observation.xml" 
470
471
            dConf['FILE_STATION_FILENAME'] = \
                 metro_util.get_metro_root_path() +\
472
                "/usr/share/metro/data/selftest/station.xml" 
473
474
            dConf['FILE_ROADCAST_FILENAME'] = \
                 metro_util.get_metro_root_path() +\
475
                "/usr/share/metro/data/selftest/roadcast.xml"
476
477
478
479
480
481
482
483
484
485
486
487
488
489
            dConf['INIT_LOGGER_VERBOSE_LEVEL'] = \
                metro_logger.LOGGER_VERBOSE_LEVEL_DEBUG

        if o == "--silent":
            dConf['INIT_LOGGER_SHELL_DISPLAY']= False



            
    return dConf



def set_default_value( ):
Miguel Tremblay's avatar
Miguel Tremblay committed
490
491
492
    """
    Initialization of configuration with hardecoded values.
    """
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566

# ------------------------------------ input -----------------------------------

    # FORECAST 
    dConfig['FILE_FORECAST_IN_FILENAME'] = \
        {'VALUE'   :"",
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("forecast filename")}

    dConfig['FILE_FORECAST_IN_CURRENT_VERSION'] = \
        {'VALUE'   :"1.1",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("current version for forecast file")}    

    dConfig['FILE_FORECAST_IN_MIN_VERSION'] = \
        {'VALUE'   :"1.1",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("min version for valid forecast file")}

    dConfig['FILE_FORECAST_IN_MAX_VERSION'] = \
        {'VALUE'   :"1.1",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("max version for valid forecast file")}    

    # OBSERVATION
    dConfig['FILE_OBSERVATION_FILENAME'] = \
        {'VALUE'   :"",
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("observation filename")}

    dConfig['FILE_OBSERVATION_CURRENT_VERSION'] = \
        {'VALUE'   :"1.0",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("current version for observation file")}

    dConfig['FILE_OBSERVATION_MIN_VERSION'] = \
        {'VALUE'   :"1.0",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("min version for valid observation file")}

    dConfig['FILE_OBSERVATION_MAX_VERSION'] = \
        {'VALUE'   :"1.0",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("max version for valid observation file")}  

    # STATION
    dConfig['FILE_STATION_FILENAME'] = \
        {'VALUE'   :"",
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("station configuration filename")}

    dConfig['FILE_STATION_CURRENT_VERSION'] = \
        {'VALUE'   :"1.0",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("current version for station file")}

    dConfig['FILE_STATION_MIN_VERSION'] = \
        {'VALUE'   :"1.0",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("min version for valid station file")}

    dConfig['FILE_STATION_MAX_VERSION'] = \
        {'VALUE'   :"1.0",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("max version for valid station file")}  

# ----------------------------------- output -----------------------------------

    dConfig['FILE_ROADCAST_FILENAME'] = \
        {'VALUE'   :"roadcast.xml",
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("roadcast filename")}

    dConfig['FILE_ROADCAST_CURRENT_VERSION'] = \
567
        {'VALUE'   :"1.6",
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("current version for roadcast file")}

# ------------------------------------ misc ------------------------------------

    dConfig['FILE_CONFIGMETRO_FILENAME'] = \
        {'VALUE'   :"metro_config.xml",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("METRo configuration filename")}

    dConfig['FILE_CONFIGMETRO_CURRENT_VERSION'] = \
        {'VALUE'   :"1.1",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("current version for METRo configuration file")}

    dConfig['FILE_LOGGER_FILENAME'] = \
François Fortin's avatar
François Fortin committed
584
        {'VALUE'   :metro_util.get_metro_root_path() + "/var/log/metro.log",
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("logger filename")}

    dConfig['FILE_LOGGER_CURRENT_VERSION'] = \
        {'VALUE'   :"1.0",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("logger filename")}



#===============================================================================
# XML file definition
#===============================================================================

# ---------------------------------- Metro data type ---------------------------


    dConfig['XML_DATATYPE_STANDARD'] = \
        {'VALUE':{'INTEGER': \
                      {'READ'  :"toolbox.metro_dom2metro_handler.read_integer",
                       'WRITE' :"toolbox.metro_metro2dom_handler.write_integer"},

                  'REAL': \
                      {'READ' :"toolbox.metro_dom2metro_handler.read_real",
                       'WRITE':"toolbox.metro_metro2dom_handler.write_real"},

                  'DATE': \
612
613
                      {'READ' :"toolbox.metro_dom2metro_handler.read_date",
                       'WRITE':"toolbox.metro_metro2dom_handler.write_date"},
614
615

                  'STRING': \
616
617
                      {'READ' :"toolbox.metro_dom2metro_handler.read_string",
                       'WRITE':"toolbox.metro_metro2dom_handler.write_string"},
618
619

                  'COORDINATE': \
620
                      {'READ' :"toolbox.metro_dom2metro_handler.read_coordinate",
621
622
623
624
625
626
627
628
629
                       'WRITE':"",
                       'CHILD':[{'NAME':"LATITUDE",
                                 'XML_TAG':"latitude",
                                 'DATA_TYPE':'REAL'},

                                {'NAME':"LONGITUDE",
                                 'XML_TAG':"longitude",
                                 'DATA_TYPE':'REAL'},
                                ]},
630
631
632
                  
                  'LIST_LEVEL_TEMP': \
                      {'READ' :"",
633
                       'WRITE':"toolbox.metro_metro2dom_handler.write_list",
634
635
                       'CHILD':[{'NAME':"LEV-TEMP",
                                 'XML_TAG':"lev-temp",
636
637
                                 'DATA_TYPE':'REAL',
                                 'PRECISION':2}
638
639
                               ]},
                  
640
641
                  'VERTICAL_LEVELS': \
                      {'READ' :"",
642
                       'WRITE':"toolbox.metro_metro2dom_handler.write_list",
643
644
645
                       'CHILD':[{'NAME':"DEPTH",
                                 'XML_TAG':"depth",
                                 'DATA_TYPE':'REAL',
François Fortin's avatar
François Fortin committed
646
                                 'PRECISION':3}
647
648
649
                               ]},

                  
650
                  'ROADLAYER_TYPE': \
651
                      {'READ'	:"toolbox.metro_dom2metro_handler.read_roadlayer_type",
652
653
654
                       'WRITE':""},

                  'DEFAULT': \
655
656
                      {'READ' :"toolbox.metro_dom2metro_handler.read_string",
                       'WRITE':"toolbox.metro_metro2dom_handler.write_string"}
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
                  },
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("standard data type for METRo XML files")}

    dConfig['XML_DATATYPE_EXTENDED'] = \
        {'VALUE'   :{},
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("extended data type for METRo XML files")}


    # -------------------------------- Forecast --------------------------------
    
    dConfig['XML_FORECAST_XPATH_ROOT'] = \
        {'VALUE'   :"forecast",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("xpath path for forecast root")}

    dConfig['XML_FORECAST_XPATH_HEADER'] = \
        {'VALUE'   :"/forecast/header",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("xpath path for forecast header")}

    dConfig['XML_FORECAST_XPATH_PREDICTION'] = \
        {'VALUE'   :"/forecast/prediction-list/prediction",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("xpath path for forecast prediction")}


    dConfig['XML_FORECAST_HEADER_STANDARD_ITEMS'] = \
        {'VALUE'    :[{'NAME':"VERSION",
                       'XML_TAG':"version",
                       'DATA_TYPE':"STRING"},

                      {'NAME':"STATION_ID",
                       'XML_TAG':"station-id",
                       'DATA_TYPE':"STRING"},

                      {'NAME':"PRODUCTION_DATE",
                       'XML_TAG':"production-date",
                       'DATA_TYPE':"DATE"},

                      {'NAME':"FILETYPE",
                       'XML_TAG':"filetype",
                       'DATA_TYPE':"STRING"},

                      
                      ],

         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("standard forecast header items")}


    dConfig['XML_FORECAST_HEADER_EXTENDED_ITEMS'] = \
        {'VALUE'    :[],
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("extended forecast header items")}


    dConfig['XML_FORECAST_PREDICTION_STANDARD_ITEMS'] = \
        {'VALUE' :[{'NAME':"FORECAST_TIME",
                    'XML_TAG':"forecast-time",
                    'DATA_TYPE':"DATE"},

                   {'NAME':"WS",
                    'XML_TAG':"ws",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"AP",
                    'XML_TAG':"ap",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"AT",
                    'XML_TAG':"at",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"TD",
                    'XML_TAG':"td",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"CC",
                    'XML_TAG':"cc",
                    'DATA_TYPE':"INTEGER"},

                   {'NAME':"SN",
                    'XML_TAG':"sn",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"RA",
                    'XML_TAG':"ra",
                    'DATA_TYPE':"REAL"},
                   ],
         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("standard forecast prediction items")}

751
    
752
    dConfig['XML_FORECAST_PREDICTION_EXTENDED_ITEMS'] = \
753
        {'VALUE'   :[],
754
755
756
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("extended forecast prediction items.")}

757
758
 
        
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
    # --------------------------------- Observation ----------------------------
    
    dConfig['XML_OBSERVATION_XPATH_ROOT'] = \
        {'VALUE'     :"observation",
         'FROM'      :CFG_INTERNAL,
         'COMMENTS'  :_("xpath path for observation root")}

    dConfig['XML_OBSERVATION_XPATH_HEADER'] = \
        {'VALUE'     :"/observation/header",
         'FROM'      :CFG_INTERNAL,
         'COMMENTS'  :_("xpath path for observation header")}

    dConfig['XML_OBSERVATION_XPATH_MEASURE'] = \
        {'VALUE'   :"/observation/measure-list/measure",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("xpath path for observation measure data")}
    
    dConfig['XML_OBSERVATION_HEADER_STANDARD_ITEMS'] = \
        {'VALUE'    :[{'NAME':"VERSION",
                       'XML_TAG':"version",
                       'DATA_TYPE':"STRING"},

                      {'NAME':"ROAD_STATION",
                       'XML_TAG':"road-station",
                       'DATA_TYPE':"STRING"},

                      {'NAME':"FILETYPE",
                       'XML_TAG':"filetype",
                       'DATA_TYPE':"STRING"},

                      ],

         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("standard observation header items")}


    dConfig['XML_OBSERVATION_HEADER_EXTENDED_ITEMS'] = \
        {'VALUE'    :[],
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("extended observation header items")}


    dConfig['XML_OBSERVATION_MEASURE_STANDARD_ITEMS'] = \
        {'VALUE' :[{'NAME':"OBSERVATION_TIME",
                    'XML_TAG':"observation-time",
                    'DATA_TYPE':"DATE"},

                   {'NAME':"AT",
                    'XML_TAG':"at",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"TD",
                    'XML_TAG':"td",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"PI",
                    'XML_TAG':"pi",
                    'DATA_TYPE':"INTEGER"},

                   {'NAME':"WS",
                    'XML_TAG':"ws",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"SC",
                    'XML_TAG':"sc",
                    'DATA_TYPE':"INTEGER"},
                   
                   {'NAME':"ST",
                    'XML_TAG':"st",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"SST",
                    'XML_TAG':"sst",
                    'DATA_TYPE':"REAL"},
                   ],

         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("standard observation header items")}


    dConfig['XML_OBSERVATION_MEASURE_EXTENDED_ITEMS'] = \
        {'VALUE'   :[],
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("extended observation measure list.")}

    
    # ----------------------------------- Station ------------------------------
    

    dConfig['XML_STATION_XPATH_ROOT'] = \
        {'VALUE'     :"station",
         'FROM'      :CFG_INTERNAL,
         'COMMENTS'  :_("xpath path for station root")}

    dConfig['XML_STATION_XPATH_HEADER'] = \
        {'VALUE'     :"/station/header",
         'FROM'      :CFG_INTERNAL,
         'COMMENTS'  :_("xpath path for station header")}

    dConfig['XML_STATION_XPATH_ROADLAYER'] = \
        {'VALUE'   :"/station/roadlayer-list/roadlayer",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("xpath path for station road layer")}

    dConfig['XML_STATION_HEADER_STANDARD_ITEMS'] = \
        {'VALUE'    :[{'NAME':"VERSION",
                       'XML_TAG':"version",
                       'DATA_TYPE':"STRING"},

                      {'NAME':"ROAD_STATION",
                       'XML_TAG':"road-station",
                       'DATA_TYPE':"STRING"},
                      
                      {'NAME':"TIME_ZONE",
                       'XML_TAG':"time-zone",
                       'DATA_TYPE':"STRING"},

                      {'NAME':"PRODUCTION_DATE",
                       'XML_TAG':"production-date",
                       'DATA_TYPE':"DATE"},

                      {'NAME':"COORDINATE",
                       'XML_TAG':"coordinate",
                       'DATA_TYPE':"COORDINATE"},

                      {'NAME':"STATION_TYPE",
                       'XML_TAG':"station-type",
                       'DATA_TYPE':"STRING"},
                      ],

         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("standard station header items")}

892

893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
    dConfig['XML_STATION_HEADER_EXTENDED_ITEMS'] = \
        {'VALUE'    :[],
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("extended station header items")}

    dConfig['XML_STATION_ROADLAYER_STANDARD_ITEMS'] = \
        {'VALUE' :[{'NAME':"POSITION",
                    'XML_TAG':"position",
                    'DATA_TYPE':'INTEGER'},

                   {'NAME':"TYPE",
                    'XML_TAG':"type",
                    'DATA_TYPE':'ROADLAYER_TYPE'},

                   {'NAME':"THICKNESS",
                    'XML_TAG':"thickness",
                    'DATA_TYPE':'REAL'},
                   ],
         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("standard road layer items")}

    dConfig['XML_STATION_ROADLAYER_EXTENDED_ITEMS'] = \
        {'VALUE' :[],
         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("extended road layer items")}


    dConfig['XML_STATION_ROADLAYER_VALID_TYPE'] = \
        {'VALUE':{'ASPHALT':1,'ASPHALTE':1,
                  'CRUSHED ROCK':2,'GRAVIER':2,
                  'CEMENT':3,'BETON':3,
Miguel Tremblay's avatar
Miguel Tremblay committed
924
                  'SAND':4, 'SABLE':4
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
                  },
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("valid station layer type")}
    
    
    # -----------------------------------  Roadcast ----------------------------
    

    dConfig['XML_ROADCAST_XPATH_ROOT'] = \
        {'VALUE'     :"roadcast",
         'FROM'      :CFG_INTERNAL,
         'COMMENTS'  :_("xpath path for roadcast root")}

    dConfig['XML_ROADCAST_XPATH_HEADER'] = \
        {'VALUE'     :"/roadcast/header",
         'FROM'      :CFG_INTERNAL,
         'COMMENTS'  :_("xpath path for roadcast header")}

    dConfig['XML_ROADCAST_XPATH_PREDICTION'] = \
        {'VALUE'   :"/roadcast/prediction-list/prediction",
         'FROM'    :CFG_INTERNAL,
         'COMMENTS':_("xpath path for roadcast measure data")}

    dConfig['XML_ROADCAST_HEADER_STANDARD_ITEMS'] = \
        {'VALUE'    :[{'NAME':"VERSION",
                       'XML_TAG':"version",
                       'DATA_TYPE':"STRING"},

                      {'NAME':"PRODUCTION_DATE",
                       'XML_TAG':"production-date",
                       'DATA_TYPE':"DATE"},

                      {'NAME':"ROAD_STATION",
                       'XML_TAG':"road-station",
                       'DATA_TYPE':"STRING"},

                      {'NAME':"LATITUDE",
                       'XML_TAG':"latitude",
                       'DATA_TYPE':"REAL"},

                      {'NAME':"LONGITUDE",
                       'XML_TAG':"longitude",
                       'DATA_TYPE':"REAL"},

                      {'NAME':"FILETYPE",
                       'XML_TAG':"filetype",
                       'DATA_TYPE':"STRING"},

                      {'NAME':"FIRST_ROADCAST",
                       'XML_TAG':"first-roadcast",
                       'DATA_TYPE':"STRING"},
976
                     
977
978
979
980
981
982
983
984
                      ],

         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("standard roadcast header items")}


    dConfig['XML_ROADCAST_HEADER_EXTENDED_ITEMS']  = \
        {'VALUE'    :[],
985
         'FROM'     :CFG_INTERNAL,
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
         'COMMENTS' :_("extended roadcast header items")}

    dConfig['XML_ROADCAST_PREDICTION_STANDARD_ITEMS'] = \
        {'VALUE' :[{'NAME':"ROADCAST_TIME",
                    'XML_TAG':"roadcast-time",
                    'DATA_TYPE':"DATE"},
                   
                   {'NAME':"HH",
                    'XML_TAG':"hh",
                    'DATA_TYPE':"REAL",
                    'PRECISION':2},
                   
                   {'NAME':"AT",
                    'XML_TAG':"at",
                    'DATA_TYPE':"REAL",
                    'PRECISION':2},

                   {'NAME':"TD",
                    'XML_TAG':"td",
                    'DATA_TYPE':"REAL",
                    'PRECISION':2},

                   {'NAME':"WS",
                    'XML_TAG':"ws",
                    'DATA_TYPE':"REAL",
                    'PRECISION':2},

                   {'NAME':"SN",
                    'XML_TAG':"sn",
                    'DATA_TYPE':"REAL",
                    'PRECISION':2},

                   {'NAME':"RA",
                    'XML_TAG':"ra",
                    'DATA_TYPE':"REAL",
                    'PRECISION':2},

                   {'NAME':"QP-SN",
                    'XML_TAG':"qp-sn",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"QP-RA",
                    'XML_TAG':"qp-ra",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"CC",
                    'XML_TAG':"cc",
                    'DATA_TYPE':"INTEGER"},

                   {'NAME':"SF",
                    'XML_TAG':"sf",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"IR",
                    'XML_TAG':"ir",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"FV",
                    'XML_TAG':"fv",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"FC",
                    'XML_TAG':"fc",
                    'DATA_TYPE':"REAL"},
                   
                   {'NAME':"FA",
                    'XML_TAG':"fa",
                    'DATA_TYPE':"REAL"},
                   
                   {'NAME':"FG",
                    'XML_TAG':"fg",
                    'DATA_TYPE':"REAL"},
                   
                   {'NAME':"BB",
                    'XML_TAG':"bb",
                    'DATA_TYPE':"REAL"},
                   
                   {'NAME':"FP",
                    'XML_TAG':"fp",
                    'DATA_TYPE':"REAL"},

                   {'NAME':"RC",
                    'XML_TAG':"rc",
                    'DATA_TYPE':"INTEGER"},

                   {'NAME':"ST",
                    'XML_TAG':"st",
                    'DATA_TYPE':"REAL",
1074
1075
1076
1077
1078
                    'PRECISION':2},

                   {'NAME':"SST",
                    'XML_TAG':"sst",
                    'DATA_TYPE':"REAL",
1079
                    'PRECISION':2},
1080

1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
                   ],

         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("standard roadcast prediction items")}


    dConfig['XML_ROADCAST_PREDICTION_EXTENDED_ITEMS'] = \
        {'VALUE'   :[ ],
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("extended roadcast prediction list.")}



#===============================================================================
# Metro data definition
#===============================================================================

# ---------------------------------- forecast ----------------------------------
    dConfig['DATA_ATTRIBUTE_FORECAST_STANDARD'] = \
        {'VALUE'    :[],
         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("default forecast attribute.")}

    dConfig['DATA_ATTRIBUTE_FORECAST_EXTENDED'] = \
        {'VALUE'    :[],
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("extended forecast attribute.")}

# --------------------------------- observation --------------------------------

    dConfig['DATA_ATTRIBUTE_OBSERVATION_STANDARD'] = \
        {'VALUE'    :["SST_VALID",                      
                      "AT_VALID",
                      "TD_VALID",
                      "WS_VALID",
                      "SST_VALID_INTERPOLATED",                      
                      "AT_VALID_INTERPOLATED",
                      "TD_VALID_INTERPOLATED",
                      "WS_VALID_INTERPOLATED",
                      "DELTA_T",
1121
                      "NO_OBS"
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
                      ],
         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("default observation attribute.")}

    dConfig['DATA_ATTRIBUTE_OBSERVATION_EXTENDED'] = \
        {'VALUE'    :[],
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("extended observation attribute.")}

# --------------------------------- roadcast --------------------------------

    dConfig['DATA_ATTRIBUTE_ROADCAST_STANDARD'] = \
        {'VALUE'    :["OBSERVATION_LENGTH",
                      "OBSERVATION_DELTAT_T",
                      "FORECAST_NB_TIMESTEPS"
                      ],
         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("default observation attribute.")}

    dConfig['DATA_ATTRIBUTE_ROADCAST_EXTENDED'] = \
        {'VALUE'    :[],
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("extended observation attribute.")}

Miguel Tremblay's avatar
Miguel Tremblay committed
1146
1147
1148
1149
1150
    dConfig['DATA_ATTRIBUTE_LAST_OBSERVATION'] = \
        {'VALUE'    :[],
         'FROM'     :CFG_INTERNAL,
         'COMMENTS' :_("time of the last observation.")}

1151
1152
1153
1154
1155
#===============================================================================
# Metro initialisation variable
#===============================================================================

    dConfig['INIT_LOGGER_VERBOSE_LEVEL'] = \
1156
        {'VALUE'   :metro_logger.LOGGER_VERBOSE_LEVEL_NORMAL,
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("logger verbosity level")}

    dConfig['INIT_LOGGER_SHELL_DISPLAY'] = \
        {'VALUE'   :True,
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("logger shell display")}

    dConfig['INIT_DEFAULT_TIME_ZONE'] = \
        {'VALUE'   :"UTC",
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("default time zone if no TZ environment variable ") +
                    _("is defined")}

    dConfig['METRO_LANGUAGE'] = \
        {'VALUE'   :"en",
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("default language is english")}

    dConfig['INIT_MODULE_EXECUTION_SEQUENCE'] = \
        {'VALUE'   :["metro_read_forecast",
                     "metro_validate_forecast",
                     "metro_string2dom_forecast",
                     "metro_read_observation",
                     "metro_validate_observation",
                     "metro_string2dom_observation",
                     "metro_read_station",
                     "metro_validate_station",
                     "metro_string2dom_station",
                     "metro_dom2metro",
                     "metro_preprocess_validate_input",
1188
                     "metro_preprocess_qa_qc_station",
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
                     "metro_preprocess_qa_qc_forecast",
                     "metro_preprocess_interpol_forecast",
                     "metro_preprocess_fsint2",
                     "metro_preprocess_qa_qc_observation",
                     "metro_preprocess_validate_input",
                     "metro_preprocess_interpol_observation",
                     "metro_preprocess_combine",
                     "metro_model",
                     "metro_postprocess_subsample_roadcast",
                     "metro_postprocess_round_roadcast",
                     "metro_metro2dom",
                     "metro_write_roadcast",
1201
#                     "metro_write_forecast",
1202
1203
1204
1205
1206
1207
1208
                     ],
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("METro module execution sequence")}

    dConfig['INIT_ROADCAST_START_DATE'] = \
        {'VALUE'   :"",
         'FROM'    :CFG_HARDCODED,
Miguel Tremblay's avatar
Miguel Tremblay committed
1209
         'COMMENTS':_("roadcast start time")}    
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239

    dConfig['INIT_USER_ROADCAST_START_DATE'] = \
        {'VALUE'   :"",
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("user roadcast start time")}

    dConfig['INIT_MODEL_ROADCAST_START_DATE'] = \
        {'VALUE'   :"",
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("model roadcast start time")}



#===============================================================================
# Default value
#===============================================================================

    # ---------------------------- forecast ------------------------------------
    
    dConfig['DEFAULT_FORECAST_HEADER_TIMEZONE'] = \
        {'VALUE'    :'UTC',
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("default time zone for forecast header date")}

    dConfig['DEFAULT_FORECAST_PREDICTION_TIMEZONE'] = \
        {'VALUE'    :'UTC',
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("default time zone for forecast prediction date")}


1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
    dConfig['IR'] = \
        {'VALUE'   :False,
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("Use infrared value from forecast")}

    dConfig['SF'] = \
        {'VALUE'   :False,
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("Use solar flux value from forecast")}

1250
1251
1252
1253
1254
    dConfig['FA'] = \
        {'VALUE'   :False,
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("Use anthropogenic flux value from forecast")}

1255
1256
1257
1258
1259
1260
    dConfig['TL'] = \
        {'VALUE'   :False,
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("Output levels (TL) in roadcast")}
    

1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
    # ---------------------------- observation ---------------------------------


    dConfig['DEFAULT_OBSERVATION_HEADER_TIMEZONE'] = \
        {'VALUE'    :'UTC',
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("default time zone for observation header date")}

    dConfig['DEFAULT_OBSERVATION_MEASURE_TIMEZONE'] = \
        {'VALUE'    :'UTC',
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("default time zone for observation measure date")}

1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
    dConfig['DEEP_SOIL_TEMP_VALUE'] =\
        {'VALUE'    : 0.0,
         'FROM'     : CFG_HARDCODED,
         'COMMENTS' :_("Value of deep soil temperature")}

    dConfig['DEEP_SOIL_TEMP'] = \
        {'VALUE'    : False,
         'FROM'     : CFG_HARDCODED,
         'COMMENTS' :_("Is the deep soil temperature fixed?")}

1284
1285
1286
1287
1288
1289
1290
1291

    # ------------------------------ station -----------------------------------

    dConfig['DEFAULT_STATION_HEADER_TIMEZONE'] = \
        {'VALUE'    :'UTC',
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("default time zone for station header date")}

1292
1293
1294
1295
    dConfig['SST_DEPTH'] = \
        {'VALUE'   :False,
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("Use subsurface temperature sensor depth value from station")}
1296

1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307

    dConfig['SUNSHADOW'] = \
        {'VALUE'   :False,
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("Enable Sun-shadow correction")}
    
    dConfig['SUNSHADOW_METHOD'] = \
        {'VALUE'   :1,
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("Sun-shadow method number")}

1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
    # ------------------------------ roadcast ----------------------------------


    dConfig['DEFAULT_ROADCAST_HEADER_TIMEZONE'] = \
        {'VALUE'    :'UTC',
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("default time zone for roadcast header date")}

    dConfig['DEFAULT_ROADCAST_PREDICTION_TIMEZONE'] = \
        {'VALUE'    :'UTC',
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("default time zone for roadcast prediction date")}

    dConfig['DEFAULT_ROADCAST_PREDICTION_PRECISION'] = \
        {'VALUE'    :2,
         'FROM'     :CFG_HARDCODED,
         'COMMENTS' :_("default precision for roadcast prediction value")}    

    dConfig['T_BYPASS_CORE'] = \
        {'VALUE'   :False,
         'FROM'    :CFG_HARDCODED,
         'COMMENTS':_("test")}