Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Error when executing exported Python scripts: module 'cate' has no attribute 'ops' #668

Closed
Evadzi opened this issue Jun 8, 2018 · 0 comments
Assignees

Comments

@Evadzi
Copy link

Evadzi commented Jun 8, 2018

I tried to copy a workflow as python script and either save it as python script and run it in Cate CLI or in Jupyter notebook. The copied workflow was saved first as python file and the process run step by step in jupyter notebook-see below:-


import cate

Step 1

ds_1 = cate.ops.read_netcdf(file="F:\ESA_data\Landcover\delineated_data\Benin_LC_1992.nc")

Step 2

plot_3 = cate.ops.plot_map(ds=ds_1, var="lccs_class", region="POLYGON ((0.2956897716680732 12.621907311427748, 4.539619681690051 12.621907311427748, 4.539619681690052 5.24512941270782, 0.29568977166807314 5.24512941270782, 0.2956897716680732 12.621907311427748, 0.2956897716680732 12.621907311427748))", title="My first map")

## Expected behavior**
The saved python file is expected to execute in cate CLI without objection and the step by step running of the scripts in jupyter notebook also is expected to execute without objection.

Actual behavior

The saved python file(plot.py) failed to execute in cate CLI-

python "C:\Users\PIKE\plot.py"
Traceback (most recent call last):
File "C:\Users\PIKE\plot.py", line 4, in
ds_1 = cate.ops.read_netcdf(file="F:\ESA_data\Landcover\delineated_data\Benin_LC_1992.nc")
AttributeError: module 'cate' has no attribute 'ops'

_# Step 1 also failed to execute in Jupyter notebook**_**


AttributeError Traceback (most recent call last)
in ()
----> 1 ds_1 = cate.ops.read_netcdf(file="F:\ESA_data\Landcover\delineated_data\Benin_LC_1992.nc")
AttributeError: module 'cate' has no attribute 'ops'

## # Steps to reproduce the problem_

  1. Call any satellite data using cate desktop.
  2. Copy the workflow as python script
  3. save the copied workflow as python file and execute it using cate CLI
  4. Also run the steps in jupyter notebook

# Detection of the problem_

I noticed the problem has to do with the missing 'cate.ops' attribute. IT HAS TO BE IMPORTED before the process can sucessfully execute- e.g
-----------------------------.
import cate
import cate.ops

ds_1 = cate.ops.read_netcdf(file="F:\ESA_data\Landcover\delineated_data\Benin_LC_1992.nc")

## Specifications

cate-desktop 2.0.0.dev12
Cate CLI
Jupyter notebook
Windows 10
notepad++

@forman forman self-assigned this Jun 8, 2018
@forman forman changed the title Missing 'cate.ops' Error when executing exported Python scripts: module 'cate' has no attribute 'ops' Jun 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants