www.earthdatascience.org
Open in
urlscan Pro
2606:50c0:8003::153
Public Scan
Submitted URL: http://www.earthdatascience.org/courses/intro-to-earth-data-science/open-reproducible-science/jupyter-python/code-markdown-cells...
Effective URL: https://www.earthdatascience.org/courses/intro-to-earth-data-science/open-reproducible-science/jupyter-python/code-markdown-cells...
Submission: On February 08 via manual from GB — Scanned from GB
Effective URL: https://www.earthdatascience.org/courses/intro-to-earth-data-science/open-reproducible-science/jupyter-python/code-markdown-cells...
Submission: On February 08 via manual from GB — Scanned from GB
Form analysis
1 forms found in the DOMGET https://www.earthdatascience.org/search/
<form role="search" method="get" action="https://www.earthdatascience.org/search/"> <input id="q" name="q" placeholder="Search earth data science site" type="text"> </form>
Text Content
* * Tutorials * Courses * Workshops * Tools * Blog * About EARTH DATA ANALYTICS ONLINE CERTIFICATE Enroll now! Learn more. 1. Home / 2. Courses / 3. Intro to earth data science / 4. Open reproducible science / 5. Jupyter python / 6. Code and Markdown Cells in Jupyter Notebook INTRO TO EARTH DATA SCIENCE TEXTBOOK * Units * 1. INTRODUCTION TO OPEN REPRODUCIBLE SCIENCE WORKFLOWS * Chapter 1 Open reproducible science workflows * - About Open Science * - Open Science Tools * - Project Management Best Practices * Chapter 2 Use bash to manipulate files * - Introduction to Bash * - Bash Commands * Chapter 3 Jupyter for python * - Intro to Jupyter * - Jupyter Notebook For Python * - Code and Markdown Cells * - Manage Directories Using Dashboard * - Manage Jupyter Notebooks * - Jupyter Notebook Shortcuts * SECTION 2 FILE FORMATS FOR EARTH DATA SCIENCE * Chapter 4: Text File Formats * Chapter 5: Spatial Data Formats * SECTION 3 GIT AND GITHUB * Chapter 7: Git/GitHub For Version Control * Chapter 8: GitHub for Collaboration * SECTION 4 PYTHON CODE FUNDAMENTALS * Chapter 10: Get Started with Python Variables and Lists * Chapter 11: Use Python Packages * Chapter 12: Files, Directories & Paths * SECTION 6 SCIENTIFIC DATA STRUCTURES IN PYTHON * Chapter 14: Numpy Arrays * Chapter 15: Pandas Dataframes * SECTION 7 WRITE EFFICIENT, CLEAN CODE USING OPEN SOURCE PYTHON * Chapter 16: Write Clean Expressive Code * Chapter 17: Conditional Statements in Python * Chapter 18: Loops in Python * Chapter 19: Intro to Functions in Python * Overview * Intro to Earth Data Science Home INTRO-TO-EARTH-DATA-SCIENCE-TEXTBOOK HOME LESSON 3. CODE AND MARKDOWN CELLS IN JUPYTER NOTEBOOK Jenny Palomino, Leah Wasser ON THIS PAGE * Learning Objectives * Work With Python Code and Markdown Cells in Jupyter Notebook * Rearrange Cells in a Jupyter Notebook LEARNING OBJECTIVES After completing this page, you will be able to: * Create new Code and Markdown cells within Jupyter Notebook. * Run Code and Markdown cells within Jupyter Notebook to execute Python code and render Markdown text. * List useful shortcuts for common tasks in Jupyter Notebook. WORK WITH PYTHON CODE AND MARKDOWN CELLS IN JUPYTER NOTEBOOK Recall that a Jupyter Notebook file consists of a set of cells that can store text or code. * Text Cells: Text cells allow you to write and render Markdown syntax. This is where you can describe and document your workflow. * Code Cells: Code cells allow you to write and run programming code (e.g. Python). CREATE NEW CELLS You can use either the Menu tools or Keyboard Shortcuts to create new cells. FunctionKeyboard ShortcutMenu ToolsCreate new cellEsc + a (above), Esc + b (below)Insert→ Insert Cell Above OR Insert → Insert Cell BelowCopy CellcCopy KeyPaste CellvPaste Key While the default cell type for new cells is Code, you can change the cell type of any existing cell by clicking in the cell and selecting a new cell type (e.g. Markdown) in the cell type menu in the toolbar. Cell type options include Code, Markdown, Raw NBConvert (for text to remain unmodified by nbconvert), and Heading. You can change the cell type of any cell in Jupyter Notebook using the Toolbar. The default cell type is Code. To use the Keyboard Shortcuts, hit the esc key. After that, you can change a cell to Markdown by hitting the m key, or you can change a cell to Code by hitting the y key. RUN CELLS PYTHON CODE CELLS You can run any cell in Jupyter Notebook (regardless of whether it contains Code or Markdown) using the Menu tools or Keyboard Shortcuts. FunctionKeyboard ShortcutMenu ToolsRun CellCtrl + enterCell → Run Cell For example, you can add a new Code cell and then run the following Python code (e.g. 3 + 4). Your result, or output, will be displayed below the Code cell that you run. 3 + 4 7 MARKDOWN CELLS You can run Markdown cells in the same way that you can run code cells. However, when you run a Markdown cell, the text formatted using Markdown syntax will be rendered as stylized text. This means that headings are larger and bold, bulleted lists have bullets next to them instead of *, and regular text looks normal. No outputs will appear below the Markdown cell. For example, the Markdown syntax below represents 3 headers. You can double-click in any Markdown cell to see the raw Markdown syntax, which for the cell below would appear like this raw Markdown syntax: ### This is a subtitle in Markdown #### This is a smaller subtitle ##### This is an even smaller subtitle To see the Markdown as stylized text, run the cell. It should look like the text printed below: THIS IS A SUBTITLE IN MARKDOWN THIS IS A SMALLER SUBTITLE THIS IS AN EVEN SMALLER SUBTITLE REARRANGE CELLS IN A JUPYTER NOTEBOOK You can change the order of cells within Jupyter Notebook using the up arrow and down arrow buttons on the menu bar. To do this, click inside the cell that you want to move and then press the desired arrow as many times as you need to move the Cell to the desired location. You can use the menu bar in Jupyter Notebook to move cells within the Jupyter Notebook file. CLEAR RESULTS IN JUPYTER NOTEBOOK Sometimes, you may want to clear any output results that have been produced. You can do this using the Menu: Menu ToolsCell -> Current Outputs -> Clear This will clear the current cell that you are working in, which you can activate by clicking in a cell. You can also clear all of the output using the Menu Tools. Menu ToolsCell -> All Output -> Clear Manage Directories Using Dashboard Jupyter Notebook For Python Tags Reproducible science and programming: jupyter notebook Updated: September 14, 2020 The Intro to earth data science textbook course is subject to the CC BY-SA 4.0 License . Citation DOI: https://doi.org/10.5281/zenodo.3382162 SHARE ON Twitter Facebook Google+ LinkedIn LEAVE A COMMENT YOU MAY ALSO ENJOY PLOT DATA WITH MATPLOTLIB 1 minute read This Week CALCULATE SEASONAL SUMMARY VALUES FROM CLIMATE DATA VARIABLES STORED IN NETCDF 4 FORMAT: WORK WITH MACA V2 CLIMATE DATA IN PYTHON 26 minute read Learn how to calculate seasonal summary values for MACA 2 climate data using xarray and region mask in open source Python. CALCULATE SUMMARY VALUES USING SPATIAL AREAS OF INTEREST (AOIS) INCLUDING SHAPEFILES FOR CLIMATE DATA VARIABLES STORED IN NETCDF 4 FORMAT: WORK WITH MACA V2 CLIMATE DATA IN PYTHON 32 minute read Climate datasets stored in netcdf 4 format often cover the entire globe or an entire country. Learn how to subset climate data spatially and by time slices u... HOW TO OPEN AND PROCESS NETCDF 4 DATA FORMAT IN OPEN SOURCE PYTHON 26 minute read Historic and projected climate data are most often stored in netcdf 4 format. Learn how to open and process MACA version 2 climate data for the Continental U... * © 2022 Earth Lab - All materials on this site are subject to the CC BY-SA 4.0 License. * Follow: * Twitter * GitHub * Feed Please enable JavaScript to view the comments powered by Disqus.