def setup_parser(parser): mandatory_args = parser.add_argument_group('mandatory arguments') mandatory_args.add_argument('--input-file', help='name of netcdf file that contains data ' 'that need to be modified', required=True) mandatory_args.add_argument('--output-file', help='output filename', required=True) mandatory_args.add_argument('--lat-name', help='name of 1D netcdf variable that ' 'contains latitudes', required=True) parser.add_argument('--lon-name', help='name of 1D netcdf variable that ' 'contains longitudes') string_list_parser = ListParser() parser.add_argument('--var-names', help='\'%s\'-separated list of names of netcdf ' 'variables that will be extended and saved ' 'to the output file; if the list is empty than ' 'only lat/lon coordinates will be extended; if ' 'a couple of variables contain vector field ' 'components aligned with meridians and parallels ' 'than they should appear as a single entry in ' 'the list, joined with the symbol \'+\' ' '(e.g. uwnd+vwnd)' % string_list_parser.separator, type=string_list_parser) parser.add_argument('--add', help='the Pole to add (default: %(default)s)', choices=['north', 'south', 'both'], default='north')
def setup_parser(parser): list_parser = ListParser() parser.add_argument('--input-files', type=list_parser, required=True) parser.add_argument('--output-file', required=True) parser.add_argument('--data-var-names', type=list_parser, required=True)
def setup_parser(parser): parser.add_argument('--input-file', required=True) parser.add_argument('--output-file', required=True) parser.add_argument('--appended-file', required=True) parser.add_argument('--appended-var-names', type=ListParser(), required=True)
def setup_parser(parser): list_parser = ListParser() parser.add_argument('--input-file', required=True) parser.add_argument('--data-var-names', required=True, type=list_parser) parser.add_argument('--mask-file', required=True) parser.add_argument('--output-file', required=True) parser.add_argument('--backup-values', type=list_parser) parser.add_argument('--max-iter-count', type=np.intp, default=_DEFAULT_MAX_ITER_COUNT)
def setup_parser(parser): mandatory_args = parser.add_argument_group('mandatory arguments') mandatory_args.add_argument('--input-file', help='name of netcdf file that contains ' 'vector fields that need to be rotated', required=True) mandatory_args.add_argument('--output-file', help='output filename', required=True) string_list_parser = ListParser() mandatory_args.add_argument('--var-names', help='\'%s\'-separated list of names of ' 'netcdf variables that will be rotated ' 'and/or saved to the output file; if a ' 'couple of variables contain vector ' 'field components than they should ' 'appear as a single entry in the list, ' 'joined with the symbol \'+\' ' '(e.g. uwnd+vwnd); at least one vector ' 'field must be specified' % string_list_parser.separator, type=string_list_parser, required=True) mandatory_args.add_argument('--angle-name', help='name of netcdf variable that contains ' 'angles of rotation', required=True) mandatory_args.add_argument('--angle-units', help='units of the angles of rotation', choices=['rad', 'deg'],) parser.add_argument('--angle-file', help='name of netcdf file that contains angles of ' 'rotation; if the parameter is not specified then' ' the angles are expected in the input file') parser.add_argument('--dim-names', help='\'%s\'-separated list of names of netcdf ' 'dimensions that define subfields of the input ' 'fields that need to be rotated; the dimensions ' 'must define the same shape as the angle ' 'variable has; if the parameter is not specified ' 'then the names of dimensions of the angle ' 'variable are used to identify the rotated ' 'subfields' % string_list_parser.separator, type=string_list_parser)
def setup_parser(parser): mandatory_args = parser.add_argument_group('mandatory arguments') mandatory_args.add_argument('--input-file', help='name of netcdf file that contains data ' 'that need to be projected', required=True) mandatory_args.add_argument('--grid-file', help='name of netcdf file that contains ' 'projection description', required=True) mandatory_args.add_argument('--output-file', help='output filename', required=True) mandatory_args.add_argument('--lat-name', help='name of a netcdf variable that ' 'contains latitudes', required=True) mandatory_args.add_argument('--lon-name', help='name of a netcdf variable that ' 'contains longitudes', required=True) string_list_parser = ListParser() parser.add_argument('--var-names', help='\'%s\'-separated list of names of netcdf ' 'variables that will be projected and/or saved ' 'to the output file; if the list is empty than ' 'only lat/lon coordinates will be projected; if ' 'a couple of variables contain vector field ' 'components aligned with meridians and parallels ' 'than they should appear as a single entry in ' 'the list, joined with the symbol \'+\' ' '(e.g. uwnd+vwnd)' % string_list_parser.separator, type=string_list_parser) parser.add_argument('--x-name', help='name to be given to the netcdf variable that ' 'contains x-coordinates of the applied ' 'projection', default=names.DIMVAR_X) parser.add_argument('--y-name', help='name to be given to the netcdf variable that ' 'contains y-coordinates of the applied ' 'projection', default=names.DIMVAR_Y)
def setup_parser(parser): mandatory_args = parser.add_argument_group('mandatory arguments') mandatory_args.add_argument('--input-file', help='name of netcdf file that contains ' 'fields that need to be interpolated', required=True) mandatory_args.add_argument('--output-file', help='output filename', required=True) mandatory_args.add_argument('--weight-file', help='name of netcdf file that interpolation ' 'weights will be read from', required=True) list_parser = ListParser() mandatory_args.add_argument('--var-names', help='\'%s\'-separated list of names of ' 'netcdf variables that need to be ' 'interpolated' % list_parser.separator, type=list_parser)
def setup_parser(parser): mandatory_args = parser.add_argument_group('mandatory arguments') mandatory_args.add_argument('--proj-name', help='name of projection to be used for grid ' 'generation', choices=projections.keys(), required=True) mandatory_args.add_argument('--orig-lat', help='latitude (in degrees) of the projection ' 'center', type=np.float64, required=True) mandatory_args.add_argument('--orig-lon', help='longitude (in degrees) of the ' 'projection center', type=np.float64, required=True) mandatory_args.add_argument('--x-start', help='x-coordinate (in meters) of the first ' 'grid point (after false easting)', type=np.float64, required=True) mandatory_args.add_argument('--x-count', help='number of grid points along x-axis', type=parse_pos_intp, required=True) mandatory_args.add_argument('--x-step', help='distance (in meters) between two ' 'consecutive grid points along x-axis', type=parse_pos_float, required=True) mandatory_args.add_argument('--y-start', help='y-coordinate (in meters) of the first ' 'grid point (after false northing)', type=np.float64, required=True) mandatory_args.add_argument('--y-count', help='number of grid points along y-axis', type=parse_pos_intp, required=True) mandatory_args.add_argument('--y-step', help='distance (in meters) between two ' 'consecutive grid points along y-axis', type=parse_pos_float, required=True) mandatory_args.add_argument('--output-file', help='output filename', required=True) float_list_parser = ListParser(np.float64) true_scale_help = '\'%s\'-separated list of projection\'s latitudes (in ' \ 'degrees) of true scale; number of values in the list ' \ 'depend on the projection to be used; if the list is ' \ 'empty than the default values that depend on the ' \ 'projection are used (default: %%(default)s)' \ % float_list_parser.separator parser.add_argument('--true-scale-lats', help=true_scale_help, type=float_list_parser, default=[]) parser.add_argument('--earth-radius', help='earth radius (in meters) to be used for ' 'projection (default: %(default)s)', type=np.float64, default=_DEFAULT_EARTH_RADIUS) parser.add_argument('--adjust-angle', help='optional angle of rotation for grid adjustment ' '(default: %(default)s)', type=np.float64, default=np.float64(0.0)) parser.add_argument('--easting', help='value added to all x-coordinates ' '(false easting)', type=np.float64, default=np.float64(0)) parser.add_argument('--northing', help='value added to all y-coordinates ' '(false northing)', type=np.float64, default=np.float64(0))
def setup_parser(parser): mandatory_args = parser.add_argument_group('mandatory arguments') mandatory_args.add_argument('--input-file', help='name of the input netcdf file', required=True) mandatory_args.add_argument('--output-file', help='name of the output netcdf file', required=True) string_list_parser = ListParser() mandatory_args.add_argument('--var-names', help='\'%s\'-separated list of names of ' 'netcdf variables that will be saved to ' 'the output file' % string_list_parser.separator, type=string_list_parser, action=AddToSetAction, required=True) operation_args = parser.add_argument_group('operations') string_slice_parser = PairParser(None, parse_slice) operation_args.add_argument('--slice', help='\'%s\'-separated pair of strings where ' 'the first string is a name of a netcdf ' 'dimension and the second one is a ' 'python style slicing string that will ' 'be applied to select a subset of values ' 'along the dimension (e.g. if ' 'dimension\'s name is \'lat\' and all ' 'but last values along this dimension ' 'are required than the value of this ' 'argument should be \'lat::-1\'); this ' 'argument can be specified multiple ' 'times to slice multiple dimensions' % string_slice_parser.separator, type=string_slice_parser, action=AddToDictAction, dest='slice_dict') int_list_parser = ListParser(np.intp, ',') string_int_list_parser = PairParser(None, int_list_parser) operation_args.add_argument( '--exclude-indices', help='\'%s\'-separated pair of strings where ' 'the first string is a name of a netcdf ' 'dimension and the second one is a ' '\'%s\'-separated list of indices ' '(starting from 0) that will NOT be ' 'saved to the output file; this argument ' 'can be specified multiple times to ' 'exclude indices from multiple dimensions' % (string_int_list_parser.separator, int_list_parser.separator), type=string_int_list_parser, action=AddToDictAction, dest='exclude_dict') string_int_parser = PairParser(None, np.int64) operation_args.add_argument('--min-val', help='\'%s\'-separated pair of a string and a ' 'value, where the string is a common ' 'name for a netcdf dimension and a 1D ' 'netcdf variable specified along this ' 'dimension, and the value is the minimum ' 'threshold for the variable\'s values ' 'that will be saved to the output ' '(indices that correspond to the values ' 'that are less than the threshold will ' 'be excluded from the dimension); this ' 'argument can be specified multiple ' 'times to exclude indices from multiple ' 'dimensions' % string_int_parser.separator, type=string_int_parser, action=AddToDictAction, dest='min_dict') operation_args.add_argument('--max-val', help='\'%s\'-separated pair of a string and a ' 'value, where the string is a common ' 'name for a netcdf dimension and a 1D ' 'netcdf variable specified along this ' 'dimension, and the value is the maximum ' 'threshold for the variable\'s values ' 'that will be saved to the output ' '(indices that correspond to the values ' 'that are greater than the threshold ' 'will be excluded from the dimension); ' 'this argument can be specified multiple ' 'times to exclude indices from multiple ' 'dimensions' % string_int_parser.separator, type=string_int_parser, action=AddToDictAction, dest='max_dict') time_parser = DateTimeParser() help_substring = time_parser.fmt.replace('%', '%%') string_time_parser = PairParser(None, time_parser) operation_args.add_argument('--min-time', help='\'%s\'-separated pair of a string and a ' 'timestamp in the format \'%s\', where ' 'the string is a common name for a ' 'netcdf dimension and a 1D netcdf ' 'variable specified along this ' 'dimension, and the timestamp is the ' 'minimum threshold for the variable\'s ' 'values that will be saved to the output ' '(indices that correspond to the values ' 'that are less than the threshold will ' 'be excluded from the dimension); this ' 'argument can be specified multiple ' 'times to exclude indices from multiple ' 'dimensions' % (string_time_parser.separator, help_substring), type=string_time_parser, action=AddToDictAction, dest='min_dict') operation_args.add_argument('--max-time', help='\'%s\'-separated pair of a string and a ' 'timestamp in the format \'%s\', where ' 'the string is a common name for a ' 'netcdf dimension and a 1D netcdf ' 'variable specified along this ' 'dimension, and the timestamp is the ' 'maximum threshold for the variable\'s ' 'values that will be saved to the output ' '(indices that correspond to the values ' 'that are greater than the threshold ' 'will be excluded from the dimension); ' 'this argument can be specified multiple ' 'times to exclude indices from multiple ' 'dimensions' % (string_time_parser.separator, help_substring), type=string_time_parser, action=AddToDictAction, dest='max_dict')