Changeset e7708b2 in flex_extract.git


Ignore:
Timestamp:
Jul 29, 2019, 10:01:49 AM (5 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
8ce3be6
Parents:
7c7e672
Message:

python2 downgrade/ bug fix of queue checks/improvement of grid check/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/python/mods/checks.py

    rd727af2 re7708b2  
    1 #!/usr/bin/env python3
     1#!/usr/bin/env python
    22# -*- coding: utf-8 -*-
    33#*******************************************************************************
     
    2424# ------------------------------------------------------------------------------
    2525
     26from __future__ import print_function
    2627import os
    2728import sys
     29
    2830import _config
    2931try:
     
    3234    import builtins as exceptions
    3335from datetime import datetime
    34 import numpy as np
    3536from mods.tools import my_error, silent_remove
    3637# ------------------------------------------------------------------------------
     
    8687            grid = gridx
    8788        else:
    88             raise ValueError('GRID parameter contains two values '
    89                              'which are unequal %s' (grid))
     89            raise ValueError('GRID parameter contains two '
     90                             'different values: %s' (grid))
     91    # # determine grid format
     92    # if float(grid) / 100. >= 0.5:
     93    #    # grid is defined in 1/1000 degrees; old format
     94    #    grid = '{}/{}'.format(float(grid) / 1000.,
     95    #                          float(grid) / 1000.)
     96    # elif float(grid) / 100. < 0.5:
     97    #    # grid is defined in normal degree; new format
     98    #    grid = '{}/{}'.format(float(grid), float(grid))
     99
     100
    90101    # determine grid format
    91     if float(grid) / 100. >= 0.5:
    92         # grid is defined in 1/1000 degrees; old format
    93         grid = '{}/{}'.format(float(grid) / 1000.,
    94                               float(grid) / 1000.)
    95     elif float(grid) / 100. < 0.5:
    96         # grid is defined in normal degree; new format
     102    # assumes that nobody wants grid spacings of 20 deg or more
     103    if float(grid) >= 20.:
     104        # grid is defined in 1/1000 degree; old format
     105        grid = '{}/{}'.format(float(grid) / 1000., float(grid) / 1000.)
     106    else:
     107        # grid is defined in degree; new format
    97108        grid = '{}/{}'.format(float(grid), float(grid))
     109
    98110
    99111    return grid
     
    290302        List of forecast steps in format e.g. [001, 002, ...]
    291303    '''
     304    import numpy as np
    292305
    293306    if '/' in step:
     
    466479    '''
    467480    if queue in _config.QUEUES_LIST and \
    468         not gateway or not destination or \
    469         not ecuid or not ecgid:
     481            (not gateway or not destination or
     482             not ecuid or not ecgid):
    470483        raise ValueError('\nEnvironment variables GATEWAY, DESTINATION, ECUID '
    471484                         'and ECGID were not set properly! \n '
     
    689702
    690703
    691 def check_acctime(acctime, marsclass, purefc):
     704def check_acctime(acctime, marsclass, purefc, time):
    692705    '''Guarantees that the accumulation forecast times were set.
    693706
     
    724737        elif marsclass.upper() == 'OD' and not purefc: # On-demand
    725738            acctime = '00/12'
     739        elif marsclass.upper() == 'OD' and purefc: # On-demand
     740            acctime = time[0]
    726741        else:
    727742            raise ValueError('ERROR: Accumulation forecast time can not '
     
    820835    if not job_chunk:
    821836        return job_chunk
     837    else:
     838        job_chunk = int(job_chunk)
    822839
    823840    if job_chunk < 0:
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG