NEAT is distributed as a Python package and is used primarily in notebook environments such as Jupyter Notebooks or CDF Notebooks.
CDF Notebooks environment
CDF Notebooks provide a straightforward way to get started with NEAT, even if you have no coding experience.
Prerequisites: A CDF account with access to the Data Management workspace and Build solutions.
Open CDF and launch a notebook
Navigate to Cognite Data Fusion, sign in, and select the Data Management workspace. In the left menu, select Build solutions, then Jupyter Notebooks, and launch a new notebook. Install cognite-neat
Run %pip install cognite-neat in a cell.
Import and start using NEAT
Import NeatSession and CogniteClient and start using NEAT as shown below.
from cognite.neat import NeatSession
neat = NeatSession(None)
# Start using neat by typing neat.<TAB>
Local Notebook environment
Running NEAT locally requires Python 3.10 or later and a notebook environment. The steps below use Jupyter Lab.
Prerequisites: Installed Python 3.10 or later. See python.org.
Create directory and virtual environment
Create a project directory and navigate into it. Create and activate a virtual environment.
Install cognite-neat and Jupyter Lab
Install cognite-neat, jupyterlab, and tqdm for progress bars.
Start Jupyter Lab
Run jupyter lab to start your notebook environment.
mkdir neat && cd neat
python -m venv venv
venv\Scripts\activate.bat
pip install cognite-neat
pip install jupyterlab
pip install tqdm
jupyter lab
mkdir neat && cd neat
python -m venv venv
source venv/bin/activate
pip install "cognite-neat[pyoxigraph]"
pip install jupyterlab
pip install tqdm
jupyter lab
In a notebook cell, import NeatSession and get_cognite_client and start using NEAT as shown below:
from cognite.neat import NeatSession, get_cognite_client
client = get_cognite_client(".env")
neat = NeatSession(client)
# Start using neat by typing neat.<TAB>
# Reading of a physical data model from CDF CDM
neat.physical_data_model.read.cdf("cdf_cdm", "CogniteCore", "v1")
The get_cognite_client helper reads environment variables from a .env file and creates a CogniteClient instance. This is a common pattern when working with CDF through Python. If you don’t have a .env file, the function prompts you to enter environment variables interactively and offers to save them. You can also instantiate CogniteClient directly if you prefer.
Further reading