- Timestamp:
- Dec 13, 2018, 11:49:06 PM (5 years ago)
- Branches:
- master, ctbto, dev
- Children:
- fdfaf00
- Parents:
- dbf9d89
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/python/mods/tools.py
r095dc73 r2fef1f2 167 167 type=none_or_str, default=None, 168 168 help="root directory for storing output files") 169 parser.add_argument("--flexpart _root_scripts", dest="flexpart_root_scripts",169 parser.add_argument("--flexpartdir", dest="flexpartdir", 170 170 type=none_or_str, default=None, 171 171 help="FLEXPART root directory (to find grib2flexpart \ … … 659 659 'iDirectionIncrementInDegrees', 'missingValue' 660 660 ''' 661 from eccodes import *661 from eccodes import codes_grib_new_from_file, codes_get, codes_release 662 662 663 663 data = {} … … 694 694 695 695 696 def get_dimensions( c, info):696 def get_dimensions(info, purefc, dtime, index_vals, start_date, end_date): 697 697 '''This function specifies the correct dimensions for x, y and t. 698 698 699 699 Parameters 700 700 ---------- 701 c : :obj:`ControlFile`702 Contains all the parameters of CONTROL file and703 command line.704 705 701 info : :obj:`dictionary` 706 702 Contains basic informations of the ECMWF grib files, e.g. … … 710 706 'iDirectionIncrementInDegrees', 'missingValue' 711 707 708 purefc : :obj:`integer` 709 Switch for definition of pure forecast mode or not. 710 711 dtime : :obj:`string` 712 Time step in hours. 713 714 index_vals : :obj:`list` 715 Contains the values from the keys used for a distinct selection 716 of grib messages in processing the grib files. 717 Content looks like e.g.: 718 index_vals[0]: ('20171106', '20171107', '20171108') ; date 719 index_vals[1]: ('0', '1200', '1800', '600') ; time 720 index_vals[2]: ('0', '12', '3', '6', '9') ; stepRange 721 722 start_date : :obj:`string` 723 The start date of the retrieval job. 724 725 end_date : :obj:`string` 726 The end date of the retrieval job. 727 712 728 Return 713 729 ------ … … 720 736 jy = info['Nj'] 721 737 722 start = datetime.strptime(c.start_date, '%Y%m%d') 723 end = datetime.strptime(c.end_date, '%Y%m%d') 724 it = ((end - start).days + 1) * 24/int(c.dtime) 725 print 'it', it, (end - start).days, 24/int(c.dtime) 738 if not purefc: 739 it = ((end_date - start_date).days + 1) * 24/int(dtime) 740 else: 741 # #no of step * #no of times * #no of days 742 it = len(index_vals[2]) * len(index_vals[1]) * len(index_vals[0]) 726 743 727 744 return (ix, jy, it)
Note: See TracChangeset
for help on using the changeset viewer.