Client: Installation & Setup

Accessing the client code

The NoM client code is hosted on the ESA Space Environment and Effects Git repository:

https://space-env-repo.estec.esa.int/network-of-models/code/nom.git

Note: Registration is required to access this software repository. Access to this repository can be requested by emailing space-env@esa.int


The NoM client can also be installed using the python package manager pip:

# new install
pip install git+HTTPS://USERNAME:PASSWORD@space-env-repo.estec.esa.int/network-of-models/code/nom

# update
pip install --update git+HTTPS://USERNAME:PASSWORD@space-env-repo.estec.esa.int/network-of-models/code/nom


It is recommended to install the client into a python virtual environment to avoid issues with compatibility with system python packages.



Seting up and initialising the client

At a minimum, the client is initialised by passing configuration data to specify the details of one or more NoM Servers.

This configuration file is a human-readable, JSON format file specifying one or more defined servers. Two server types are currently supported, local or rest.


client_conf_dict = {
    "servers": {
        "ext_rest_server": {
            "type": "rest",
            "server_addr": "https://nom.esa.int",
            "api_version": "api",
            "api_key": "<YOUR API KEY>"
        }
    }
}

Note: Only the rest server type is described here. Details on using the local server type can be obtained upon request.

The labels used for the servers (in this case ext_rest_server will be referred to in the initialisation of the NoM Client.

This JSON configuration can be passed to the client:

  • directly as a python dictionary or,
  • as a location to a file accessible by the NoM Client or,
  • nom.cfg file in home directory (preferred)


Passing by python dictionary:

from nom_client.nom_client import NoMClient


client_conf_dict = {
    "servers": {
        "ext_rest_server": {
            "type": "rest",
            "server_addr": "https://nom.esa.int",
            "api_version": "api",
            "api_key": "<YOUR API KEY>"
        }
    }
}

nom_client = NoMClient("array_like_inputs_example", nom_conf_file=client_conf_dict)
nom_client.set_default_server("ext_rest_server")


Passing a file location:


The file should look like this:

client_conf_dict = {
    "servers": {
        "ext_rest_server": {
            "type": "rest",
            "server_addr": "https://nom.esa.int",
            "api_version": "api",
            "api_key": "<YOUR API KEY>"
        }
    }
}

nom_client = NoMClient("array_like_inputs_example", nom_conf_file=<PATH_TO_FILE>)
nom_client.set_default_server("ext_rest_server")

If you name this file nom.cfg and place in your home directory it will be picked up automatically.



Rest configuration type

This is the most common configuration and specifies a NoM Server accessible over the web API. In the example above, there is a single server called “ext_rest_server”. This can be any string and will be used to reference this server in your python code. The configuration specifies the location of the NoM Server along with the API key required to access and run models.

Note: The API key used to authenticate with the server is placed within this configuration file, so care must be taken not to distribute this information. A common pattern to use is to replace the API with a call to an environmental variable containing the key.


Local configuration type

The local configuration allows the client to run local models. This can be useful if there is a model not hosted on any NoM Server. More about this XXX