Пример #1
0
def main(argv):
    del argv
    # Set the program name to 'earthengine' for proper help text display.
    parser = argparse.ArgumentParser(
        prog='earthengine', description='Earth Engine Command Line Interface.')

    dispatcher = CommandDispatcher(parser)

    # Print the list of commands if the user supplied no arguments at all.
    if len(sys.argv) == 1:
        parser.print_help()
        return

    args = parser.parse_args()
    config = utils.CommandLineConfig()

    # Catch EEException errors, which wrap server-side Earth Engine
    # errors, and print the error message without the irrelevant local
    # stack trace. (Individual commands may also catch EEException if
    # they want to be able to continue despite errors.)
    try:
        dispatcher.run(args, config)
    except ee.EEException as e:
        print(e)
        sys.exit(1)
Пример #2
0
def main():
    # Set the program name to 'earthengine' for proper help text display.
    parser = argparse.ArgumentParser(
        prog='earthengine', description='Earth Engine Command Line Interface.')
    parser.add_argument('--ee_config',
                        help='Path to the earthengine configuration file. '
                        'Defaults to "~/%s".' %
                        utils.DEFAULT_EE_CONFIG_FILE_RELATIVE)

    dispatcher = CommandDispatcher(parser)

    # Print the list of commands if the user supplied no arguments at all.
    if len(sys.argv) == 1:
        parser.print_help()
        return

    args = parser.parse_args()
    config = utils.CommandLineConfig(args.ee_config)

    # Catch EEException errors, which wrap server-side Earth Engine
    # errors, and print the error message without the irrelevant local
    # stack trace. (Individual commands may also catch EEException if
    # they want to be able to continue despite errors.)
    try:
        dispatcher.run(args, config)
    except ee.EEException as e:
        print(e)
        sys.exit(1)
Пример #3
0
def _run_command(*argv):
    """Runs an eecli command."""
    _ = argv

    # Set the program name to 'earthengine' for proper help text display.
    parser = argparse.ArgumentParser(
        prog='earthengine', description='Earth Engine Command Line Interface.')
    parser.add_argument('--ee_config',
                        help='Path to the earthengine configuration file. '
                        'Defaults to "~/%s".' %
                        utils.DEFAULT_EE_CONFIG_FILE_RELATIVE)
    parser.add_argument('--service_account_file',
                        help='Path to a service account credentials'
                        'file.  Overrides any ee_config if specified.')
    parser.add_argument(
        '--use_cloud_api',
        help=
        'Enables the new experimental EE Cloud API backend. (on by default)',
        action='store_true',
        dest='use_cloud_api')
    parser.add_argument(
        '--no-use_cloud_api',
        help='Disables the new experimental EE Cloud API backend.',
        action='store_false',
        dest='use_cloud_api')
    parser.add_argument(
        '--project',
        help=
        'Specifies a Google Cloud Platform Project id to override the call.',
        dest='project_override')
    parser.set_defaults(use_cloud_api=True)

    dispatcher = CommandDispatcher(parser)

    # Print the list of commands if the user supplied no arguments at all.
    if len(sys.argv) == 1:
        parser.print_help()
        return

    args = parser.parse_args()
    config = utils.CommandLineConfig(args.ee_config, args.service_account_file,
                                     args.use_cloud_api, args.project_override)

    # TODO(user): Remove this warning once things are officially launched
    #  and the old API is removed.
    if args.use_cloud_api:
        print('Running command using Cloud API.  Set --no-use_cloud_api to '
              'go back to using the API\n')

    # Catch EEException errors, which wrap server-side Earth Engine
    # errors, and print the error message without the irrelevant local
    # stack trace. (Individual commands may also catch EEException if
    # they want to be able to continue despite errors.)
    try:
        dispatcher.run(args, config)
    except ee.EEException as e:
        print(e)
        sys.exit(1)
Пример #4
0
def main(dispatcher_and_args):
  dispatcher, args = dispatcher_and_args
  config = utils.CommandLineConfig()

  # Catch EEException errors, which wrap server-side Earth Engine
  # errors, and print the error message without the irrelevant local
  # stack trace. (Individual commands may also catch EEException if
  # they want to be able to continue despite errors.)
  try:
    dispatcher.run(args, config)
  except ee.EEException as e:
    print(e)
    sys.exit(1)
Пример #5
0
def _run_command(*argv):
    """Runs an eecli command."""
    _ = argv

    # Set the program name to 'earthengine' for proper help text display.
    parser = argparse.ArgumentParser(
        prog='earthengine', description='Earth Engine Command Line Interface.')
    parser.add_argument('--ee_config',
                        help='Path to the earthengine configuration file. '
                        'Defaults to "~/%s".' %
                        utils.DEFAULT_EE_CONFIG_FILE_RELATIVE)
    parser.add_argument('--service_account_file',
                        help='Path to a service account credentials'
                        'file.  Overrides any ee_config if specified.')
    parser.add_argument(
        '--project',
        help=
        'Specifies a Google Cloud Platform Project id to override the call.',
        dest='project_override')

    dispatcher = CommandDispatcher(parser)

    # Print the list of commands if the user supplied no arguments at all.
    if len(sys.argv) == 1:
        parser.print_help()
        return

    args = parser.parse_args()
    config = utils.CommandLineConfig(args.ee_config, args.service_account_file,
                                     args.project_override)

    # Catch EEException errors, which wrap server-side Earth Engine
    # errors, and print the error message without the irrelevant local
    # stack trace. (Individual commands may also catch EEException if
    # they want to be able to continue despite errors.)
    try:
        dispatcher.run(args, config)
    except ee.EEException as e:
        print(e)
        sys.exit(1)
Пример #6
0
def main():
    # Set the program name to 'earthengine' for proper help text display.
    parser = argparse.ArgumentParser(
        prog='earthengine', description='Earth Engine Command Line Interface.')
    parser.add_argument('--ee_config',
                        help='Path to the earthengine configuration file. '
                        'Defaults to "~/%s".' %
                        utils.DEFAULT_EE_CONFIG_FILE_RELATIVE)
    parser.add_argument('--service_account_file',
                        help='Path to a service account credentials'
                        'file.  Overrides any ee_config if specified.')
    parser.add_argument(
        '--use_cloud_api',
        help='Experimental: whether to use new EE Cloud API. '
        'Not for broad use yet, as many calls have not been ported.',
        action='store_true')

    dispatcher = CommandDispatcher(parser)

    # Print the list of commands if the user supplied no arguments at all.
    if len(sys.argv) == 1:
        parser.print_help()
        return

    args = parser.parse_args()
    config = utils.CommandLineConfig(args.ee_config, args.service_account_file,
                                     args.use_cloud_api)

    # Catch EEException errors, which wrap server-side Earth Engine
    # errors, and print the error message without the irrelevant local
    # stack trace. (Individual commands may also catch EEException if
    # they want to be able to continue despite errors.)
    try:
        dispatcher.run(args, config)
    except ee.EEException as e:
        print(e)
        sys.exit(1)