|
| 1 | +# Installation |
| 2 | + |
| 3 | +Install Xee and its dependencies using `pip` or conda-like package managers. To |
| 4 | +help minimize system disruption and package conflicts, it's recommended to use |
| 5 | +virtual environments like Python's |
| 6 | +[`venv`](https://docs.python.org/3/library/venv.html) with `pip` or [conda's |
| 7 | +integrated environment management |
| 8 | +system](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html). |
| 9 | + |
| 10 | +Install with `pip`: |
| 11 | + |
| 12 | +```shell |
| 13 | +pip install --upgrade xee |
| 14 | +``` |
| 15 | + |
| 16 | +Install with conda: |
| 17 | + |
| 18 | +```shell |
| 19 | +conda install -c conda-forge xee |
| 20 | +``` |
| 21 | + |
| 22 | +## Earth Engine setup |
| 23 | + |
| 24 | +Xee makes requests to [Google Earth |
| 25 | +Engine](https://developers.google.com/earth-engine/guides) for data. To use |
| 26 | +Earth Engine, you'll need to create and register a Google Cloud project, |
| 27 | +authenticate with Google, and initialize the service. |
| 28 | + |
| 29 | +If you already have a Cloud project registered for Earth Engine and are familiar |
| 30 | +with Earth Engine authentication and initialization, you can skip this section. |
| 31 | + |
| 32 | +**Note**: the authentication and initialization steps described in the following |
| 33 | +sections cover the majority of common system configurations and access methods, |
| 34 | +if you're having trouble, refer to the Earth Engine [Authentication and |
| 35 | +Initialization guide](https://developers.google.com/earth-engine/guides/auth). |
| 36 | + |
| 37 | +### Create and register a Cloud project |
| 38 | + |
| 39 | +Follow instructions in the [Earth Engine Access |
| 40 | +guide](https://developers.google.com/earth-engine/guides/access#get_access_to_earth_engine |
| 41 | +) to create and register a Google Cloud project. |
| 42 | + |
| 43 | +### Authentication |
| 44 | + |
| 45 | +Google needs to know who is accessing Earth Engine to determine what services |
| 46 | +are available and what permissions are granted. The goal of authentication is to |
| 47 | +establish credentials that can be used during initialization. There are several |
| 48 | +ways to verify your identity and create credentials, depending on your working |
| 49 | +environment: |
| 50 | + |
| 51 | +#### Persistent environment |
| 52 | + |
| 53 | +If you're working from a system with a persistent environment, such as a local |
| 54 | +computer or on-premises server, you can authenticate using the [Earth Engine |
| 55 | +command line |
| 56 | +utility](https://developers.google.com/earth-engine/guides/command_line#authenticate): |
| 57 | + |
| 58 | +```shell |
| 59 | +earthengine authenticate |
| 60 | +``` |
| 61 | + |
| 62 | +This command opens a browser window for authentication. Once authenticated, the |
| 63 | +credentials are stored locally (`~/.config/earthengine/credentials`), allowing |
| 64 | +them to be used in subsequent initialization to the Earth Engine service. This |
| 65 | +is typically a one-time step. |
| 66 | + |
| 67 | +#### Temporary environment |
| 68 | + |
| 69 | +If you're working from a system like [Google Colab](https://colab.google/) that |
| 70 | +provides a temporary environment recycled after use, you'll need to authenticate |
| 71 | +every session. In this case, you can use the `earthengine-api` library |
| 72 | +(installed with Xee) to authenticate interactively: |
| 73 | + |
| 74 | +```python |
| 75 | +ee.Authenticate() |
| 76 | +``` |
| 77 | + |
| 78 | +This method selects the most appropriate [authentication |
| 79 | +mode](https://developers.google.com/earth-engine/guides/auth#authentication_details) |
| 80 | +and guides you through steps to generate authentication credentials. Be sure to |
| 81 | +rerun the authentication process each time the environment is reset. |
| 82 | + |
| 83 | +### Initialization |
| 84 | + |
| 85 | +Initialization checks user authentication credentials, sets the Cloud project to |
| 86 | +use for requests, and connects the client to Earth Engine's services. At the |
| 87 | +top of your script, include one of the following expressions with the `project` |
| 88 | +argument modified to match the Google Cloud project ID enabled and registered |
| 89 | +for Earth Engine use. |
| 90 | + |
| 91 | +#### High-volume endpoint |
| 92 | + |
| 93 | +If you are requesting stored data (supplying a collection ID or passing an |
| 94 | +unmodified `ee.ImageCollection()` object to `xarray.open_dataset`), connect to |
| 95 | +the [high-volume |
| 96 | +endpoint](https://developers.google.com/earth-engine/guides/processing_environments#high-volume_endpoint). |
| 97 | + |
| 98 | +```python |
| 99 | +ee.Initialize( |
| 100 | + project='your-project-id', |
| 101 | + opt_url='https://earthengine-highvolume.googleapis.com' |
| 102 | +) |
| 103 | +``` |
| 104 | + |
| 105 | +#### Standard endpoint |
| 106 | + |
| 107 | +If you are requesting computed data (applying expressions to the data), consider |
| 108 | +connecting to the [standard |
| 109 | +endpoint](https://developers.google.com/earth-engine/guides/processing_environments#standard_endpoint). |
| 110 | +It utilizes caching, so it can be more efficient if you need to rerun or adjust |
| 111 | +something about the request. |
| 112 | + |
| 113 | +```python |
| 114 | + ee.Initialize(project='your-project-id') |
| 115 | +``` |
0 commit comments