Changeset 6f951ca in flex_extract.git for source/python/mods/checks.py
- Timestamp:
- Jan 15, 2019, 1:05:10 AM (5 years ago)
- Branches:
- master, ctbto, dev
- Children:
- d4696e0
- Parents:
- 2625ca8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/python/mods/checks.py
rf2616a3 r6f951ca 1 1 #!/usr/bin/env python 2 2 # -*- coding: utf-8 -*- 3 # #*******************************************************************************3 #******************************************************************************* 4 4 # @Author: Anne Philipp (University of Vienna) 5 5 # … … 9 9 # 10 10 # @License: 11 # (C) Copyright 2014-2018. 11 # (C) Copyright 2014-2019. 12 # Anne Philipp, Leopold Haimberger 12 13 # 13 # This software is licensed under the terms of the Apache Licence Version 2.0 14 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 15 # 16 # @Modul Description: 17 # 18 # 19 # @Module Content: 20 21 # 14 # This work is licensed under the Creative Commons Attribution 4.0 15 # International License. To view a copy of this license, visit 16 # http://creativecommons.org/licenses/by/4.0/ or send a letter to 17 # Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. 22 18 #******************************************************************************* 19 '''This module contains check methods for the CONTROL paramaters. 20 ''' 23 21 24 22 # ------------------------------------------------------------------------------ … … 27 25 28 26 import os 27 import sys 29 28 import _config 30 29 import exceptions … … 40 39 Parameters 41 40 ---------- 42 c : :obj:`ControlFile`41 c : ControlFile 43 42 Contains all the parameters of CONTROL file and 44 43 command line. 45 44 46 logicals : :obj:`list` of (:obj:`string` or :obj:`integer`)45 logicals : list of (str or int) 47 46 Names of the switches that are used to control the flow of the 48 47 program. … … 67 66 Parameters 68 67 ---------- 69 grid : :obj:`string`68 grid : str 70 69 Contains grid information 71 70 72 71 Return 73 72 ------ 74 grid : :obj:``string`73 grid : str 75 74 Contains grid in format Lat/lon. E.g. 0.1/0.1 76 75 ''' … … 108 107 Parameters 109 108 ---------- 110 grid : :obj:`string`109 grid : str 111 110 Contains grid information. 112 111 113 area : :obj:`string`112 area : str 114 113 Contains area informtion. 115 114 116 upper : :obj:`string`115 upper : str 117 116 The northern most latitude. 118 117 119 lower : :obj:`string`118 lower : str 120 119 The souther most latitude. 121 120 122 left : :obj:`string`121 left : str 123 122 The western most longitude. 124 123 125 right : :obj:`string`124 right : str 126 125 The eastern most longiude. 127 126 128 127 Return 129 128 ------ 130 grid : :obj:``string`129 grid : str 131 130 Contains grid in format Lat/lon. E.g. 0.1/0.1 132 131 ''' … … 173 172 Parameters 174 173 ---------- 175 levelist : :obj:`string`174 levelist : str 176 175 Specifies the level list. 177 176 Examples: model level: 1/to/137, pressure levels: 500/to/1000 178 177 179 level : :obj:`string`178 level : str 180 179 Specifies the maximum level. 181 180 182 181 Return 183 182 ------ 184 levelist : :obj:`string`183 levelist : str 185 184 Specifies the required levels. It has to have a valid 186 185 correspondence to the selected levtype. 187 186 Examples: model level: 1/to/137, pressure levels: 500/to/1000 188 187 189 level : :obj:`string`188 level : str 190 189 Specifies the maximum level. It has to be one of the 191 190 available maximum level number as contained in the variable … … 221 220 Parameters 222 221 ---------- 223 c : :obj:`ControlFile`222 c : ControlFile 224 223 Contains all the parameters of CONTROL file and 225 224 command line. 226 225 227 ppid : :obj:`int` or :obj:`None`226 ppid : int or None 228 227 Contains the ppid number provided by the command line parameter 229 228 of is None otherwise. … … 247 246 Parameters 248 247 ---------- 249 ftype : :obj:`list` of :obj:`string`248 ftype : list of str 250 249 List of field types. 251 250 … … 273 272 Parameters 274 273 ---------- 275 step : :obj:`list` of :obj:`string` or :obj:`string`274 step : list of str or str 276 275 Specifies the forecast time step from forecast base time. 277 276 Valid values are hours (HH) from forecast base time. 278 277 279 mailfail : :obj:`list` of :obj:``string`278 mailfail : list of str 280 279 Contains all email addresses which should be notified. 281 280 It might also contain just the ecmwf user name which will trigger … … 284 283 Return 285 284 ------ 286 step : :obj:`list` of :obj:`string`285 step : list of str 287 286 List of forecast steps in format e.g. [001, 002, ...] 288 287 ''' … … 313 312 Parameters 314 313 ---------- 315 ftype : :obj:`list` of :obj:`string` or :obj:`string`314 ftype : list of str or str 316 315 List of field types. 317 316 318 steps : :obj:`string`317 steps : str 319 318 Specifies the forecast time step from forecast base time. 320 319 Valid values are hours (HH) from forecast base time. … … 322 321 Return 323 322 ------ 324 ftype : :obj:`list` of :obj:`string`323 ftype : list of str 325 324 List of field types. 326 325 ''' … … 340 339 Parameters 341 340 ---------- 342 ftime : :obj:`list` of :obj:`string` or :obj:`string`341 ftime : list of str or str 343 342 The time in hours of the field. 344 343 345 344 Return 346 345 ------ 347 ftime : :obj:`list` of :obj:`string`346 ftime : list of str 348 347 The time in hours of the field. 349 348 ''' … … 358 357 Parameters 359 358 ---------- 360 ftype : :obj:`list` of :obj:`string`359 ftype : list of str 361 360 List of field types. 362 361 363 ftime : :obj:`list` of :obj:`string` or :obj:`string`362 ftime : list of str or str 364 363 The time in hours of the field. 365 364 366 steps : :obj:`string`365 steps : str 367 366 Specifies the forecast time step from forecast base time. 368 367 Valid values are hours (HH) from forecast base time. 369 368 370 maxstep : :obj:`integer`369 maxstep : int 371 370 The maximum forecast time step in hours from the forecast base time. 372 371 This is the maximum step for non flux (accumulated) forecast data. 373 372 374 purefc : :obj:`integer`373 purefc : int 375 374 Switch for definition of pure forecast mode or not. 376 375 377 376 Return 378 377 ------ 379 ftype : :obj:`list` of :obj:`string`378 ftype : list of str 380 379 List of field types. 381 380 382 ftime : :obj:`list` of :obj:`string`381 ftime : list of str 383 382 The time in hours of the field. 384 383 385 steps : :obj:`string`384 steps : str 386 385 Specifies the forecast time step from forecast base time. 387 386 Valid values are hours (HH) from forecast base time. … … 410 409 Parameters 411 410 ---------- 412 mail : :obj:`list` of :obj:`string` or :obj:`string`411 mail : list of str or str 413 412 Contains email addresses for notifications. 414 413 It might also contain just the ecmwf user name which will trigger … … 417 416 Return 418 417 ------ 419 mail : :obj:`list` of :obj:``string`418 mail : list of str 420 419 Contains email addresses for notifications. 421 420 It might also contain just the ecmwf user name which will trigger … … 439 438 Parameters 440 439 ---------- 441 queue : :obj:`string`440 queue : str 442 441 Name of the queue if submitted to the ECMWF servers. 443 442 Used to check if ecuid, ecgid, gateway and destination 444 443 are set correctly and are not empty. 445 444 446 gateway : :obj:`string`445 gateway : str 447 446 The address of the gateway server. 448 447 449 destination : :obj:`string`448 destination : str 450 449 The name of the destination of the gateway server for data 451 450 transfer through ectrans. E.g. name@genericSftp 452 451 453 ecuid : :obj:`string`452 ecuid : str 454 453 ECMWF user id. 455 454 456 ecgid : :obj:`string`455 ecgid : str 457 456 ECMWF group id. 458 457 … … 475 474 Parameters 476 475 ---------- 477 idir : :obj:`string`476 idir : str 478 477 Path to the temporary directory for MARS retrieval data. 479 478 480 odir : :obj:`string`479 odir : str 481 480 Path to the final output directory where the FLEXPART input files 482 481 will be stored. 483 482 484 fpdir : :obj:`string`483 fpdir : str 485 484 Path to FLEXPART root directory. 486 485 487 fedir : :obj:`string`486 fedir : str 488 487 Path to flex_extract root directory. 489 488 490 489 Return 491 490 ------ 492 odir : :obj:`string`491 odir : str 493 492 Path to the final output directory where the FLEXPART input files 494 493 will be stored. 495 494 496 fpdir : :obj:`string`495 fpdir : str 497 496 Path to FLEXPART root directory. 498 497 … … 513 512 Parameters 514 513 ---------- 515 start : :obj:`string`514 start : str 516 515 The start date of the retrieval job. 517 516 518 end : :obj:`string`517 end : str 519 518 The end date of the retrieval job. 520 519 521 520 Return 522 521 ------ 523 start : :obj:`string`522 start : str 524 523 The start date of the retrieval job. 525 524 526 end : :obj:`string`525 end : str 527 526 The end date of the retrieval job. 528 527 … … 555 554 Parameters 556 555 ---------- 557 maxstep : :obj:`string`556 maxstep : str 558 557 The maximum forecast time step in hours from the forecast base time. 559 558 This is the maximum step for non flux (accumulated) forecast data. 560 559 561 steps : :obj:`string`560 steps : str 562 561 Specifies the forecast time step from forecast base time. 563 562 Valid values are hours (HH) from forecast base time. … … 565 564 Return 566 565 ------ 567 maxstep : :obj:`integer`566 maxstep : int 568 567 The maximum forecast time step in hours from the forecast base time. 569 568 This is the maximum step for non flux (accumulated) forecast data. … … 588 587 Parameters 589 588 ---------- 590 basetime : :obj:``589 basetime : str 591 590 The time for a half day retrieval. The 12 hours upfront are to be 592 591 retrieved. … … 607 606 Parameters 608 607 ---------- 609 request : :obj:`integer`608 request : int 610 609 Selects the mode of retrieval. 611 610 0: Retrieves the data from ECMWF. … … 613 612 2: Retrieves the data and prints the mars request. 614 613 615 marsfile : :obj:`string`614 marsfile : str 616 615 Path to the mars request file. 617 616 … … 631 630 Parameters 632 631 ---------- 633 public : :obj:`ìnteger`632 public : int 634 633 Specifies if public data are to be retrieved or not. 635 634 636 dataset : :obj:`string`635 dataset : str 637 636 Specific name which identifies the public dataset. 638 637 … … 653 652 Parameters 654 653 ---------- 655 acctype : :obj:`string`654 acctype : str 656 655 The field type for the accumulated forecast fields. 657 656 658 ftype : :obj:`list` of :obj:`string`657 ftype : list of str 659 658 List of field types. 660 659 661 660 Return 662 661 ------ 663 acctype : :obj:`string`662 acctype : str 664 663 The field type for the accumulated forecast fields. 665 664 ''' … … 690 689 Parameters 691 690 ---------- 692 acctime : :obj:`string`691 acctime : str 693 692 The starting time from the accumulated forecasts. 694 693 695 acctype : :obj:`string`694 acctype : str 696 695 The field type for the accumulated forecast fields. 697 696 698 purefc : :obj:`integer`697 purefc : int 699 698 Switch for definition of pure forecast mode or not. 700 699 701 700 Return 702 701 ------ 703 acctime : :obj:`string`702 acctime : str 704 703 The starting time from the accumulated forecasts. 705 704 ''' 706 705 if not acctime: 707 706 print('... Control parameter ACCTIME was not defined.') 708 print('... Value will be set depending on field type: '707 print('... Value will be set depending on field type:\n ' 709 708 '\t\t EA=06/18\n\t\t EI/OD=00/12\n\t\t EP=18') 710 709 if acctype.upper() == 'EA': # Era 5 … … 726 725 Parameters 727 726 ---------- 728 accmaxstep : :obj:`string`727 accmaxstep : str 729 728 The maximum forecast step for the accumulated forecast fields. 730 729 731 acctype : :obj:`string`730 acctype : str 732 731 The field type for the accumulated forecast fields. 733 732 734 purefc : :obj:`integer`733 purefc : int 735 734 Switch for definition of pure forecast mode or not. 736 735 737 maxstep : :obj:`string`736 maxstep : str 738 737 The maximum forecast time step in hours from the forecast base time. 739 738 This is the maximum step for non flux (accumulated) forecast data. … … 741 740 Return 742 741 ------ 743 accmaxstep : :obj:`string`742 accmaxstep : str 744 743 The maximum forecast step for the accumulated forecast fields. 745 744 ''' … … 776 775 Parameters 777 776 ---------- 778 addpar : :obj:`string` or :obj:'list' of :obj:'string'777 addpar : str or list of str 779 778 List of additional parameters to be retrieved. 780 779 781 780 Return 782 781 ------ 783 addpar : :obj:'string'782 addpar : str 784 783 List of additional parameters to be retrieved. 785 784 ''' … … 798 797 799 798 def check_job_chunk(job_chunk): 800 '''Checks that the job chunknumber is positive and non zero.801 802 Parameters 803 ---------- 804 job_chunk : :obj:`integer`799 '''Checks that if job chunk is set, the number is positive and non zero. 800 801 Parameters 802 ---------- 803 job_chunk : int 805 804 The number of days for a single job script. 806 805 807 806 Return 808 807 ------ 809 job_chunk : :obj:`integer`808 job_chunk : int 810 809 The number of days for a single job script. 811 810 ''' 811 if not job_chunk: 812 return job_chunk 813 812 814 if job_chunk < 0: 813 815 raise ValueError('ERROR: The number of job chunk is negative!\n'
Note: See TracChangeset
for help on using the changeset viewer.