ProjectPythia / pythia-foundations

Jupyterbook source for the Foundations collection
http://foundations.projectpythia.org
Apache License 2.0
59 stars 42 forks source link

Data Formats module error with "netcdf forecast_model" data structure #426

Open ejlevine opened 10 months ago

ejlevine commented 10 months ago

I am working through the Pythia Foundations Data Formats module. When I run with the following code block:

netcdf forecast_model { attributes: :Conventions = "CF-1.7" ; :title = "Forecast model run" ; :institution = "Unidata" ; :source = "WRF-1.5" ; :history = "2019-07-16 02:21:52.005718 Python" ; :references = "" ; :comment = "" ; }

I get an error message:

runfile('~/pythia/NetCDF/ProjectPythiaNetCDF.py', wdir='~/pythia/NetCDF') File :59 netcdf forecast_model { ^ SyntaxError: invalid syntax

This happens in both spyder and ipython.

I'm in the right environment and netcdf is installed:

(pythia-book-dev) ejlevine@callisto:~/pythia/NetCDF$ conda env list

conda environments:

# base /home/ejlevine/miniconda3 pythia-book-dev * /home/ejlevine/miniconda3/envs/pythia-book-dev

(pythia-book-dev) ejlevine@callisto:~/pythia/NetCDF$ conda list netcdf

packages in environment at /home/ejlevine/miniconda3/envs/pythia-book-dev:

#

Name Version Build Channel

libnetcdf 4.9.2 nompi_h7e745eb_109 conda-forge netcdf4 1.6.4 nompi_py311h9a7c333_101 conda-forge

I'm running on openSUSE Leap 15.4.

Can someone please help me fix this?

thanks, -eric

ktyle commented 10 months ago

Hi @ejlevine,

It looks like you are trying to run a block of Markdown text:

netcdf forecast_model {
attributes:
:Conventions = "CF-1.7" ;
:title = "Forecast model run" ;
:institution = "Unidata" ;
:source = "WRF-1.5" ;
:history = "2019-07-16 02:21:52.005718 Python" ;
:references = "" ;
:comment = "" ;
}

i.e., that block is not executable Python code.

I agree that the way it is rendered and written in our Jupyterbook does not easily distinguish it from the code block that immediately precedes it, although if one downloads the tutorial as a Jupyter notebook and runs it via Jupyter Lab, it won't be treated as a code cell.