# MESA Trainings — full corpus Each page below begins with its canonical URL followed by its original Markdown, OKF frontmatter included. Relative links have been rewritten to absolute URLs. ---8<--- https://idss-mesa.github.io/trainings/ --- okf_version: "0.2" title: MESA Trainings description: MESA Trainings — short, single-task tutorials for the MESA Portal at mesa.cyverse.org and its apps, written for training participants and for anyone using MESA. icon: lucide/graduation-cap --- # MESA Trainings Short tutorials for getting things done on **MESA**, the Multidisciplinary Environment for Scientific Advancement. Each one takes you through a single task in five to ten minutes, tells you what you should see at every step, and ends with a check that shows whether it worked. They are written for two readers: people preparing for a MESA training session, and anyone using MESA who wants to get one thing done. You do not need to be part of a training program to use them. [New to MESA? Start here :material-arrow-right:](https://idss-mesa.github.io/trainings/pathways/new-to-mesa/){ .md-button .md-button--primary } [Choose a pathway](https://idss-mesa.github.io/trainings/pathways/){ .md-button } [All tutorials](https://idss-mesa.github.io/trainings/tutorials/){ .md-button } !!! warning "These tutorials are drafts" The portal tutorials were written from the [MESA documentation](https://idss-mesa.github.io/docs/), and the code in the data tutorials was run on a laptop. None has yet been checked step by step on the live portal. Each page says so at the top and at the bottom. When a tutorial has been validated, its last line gives the date, who checked it, and what it was checked against. ## Getting started These five tutorials take you from nothing to a saved notebook, in order. You need a web browser and a free [CyVerse account](https://user.cyverse.org). | I want to… | Tutorial | Time | |---|---|---| | Get into the portal | [Sign in to the MESA Portal with a CyVerse account](https://idss-mesa.github.io/trainings/tutorials/sign-in/) | 5 min | | See the data MESA shares | [Find MESA's community data in the Data Browser](https://idss-mesa.github.io/trainings/tutorials/find-community-data/) | 5 min | | Be allowed to start apps on a new account | [Ask CyVerse for access to interactive apps](https://idss-mesa.github.io/trainings/tutorials/request-app-access/) | 5 min | | Start working in a notebook | [Launch MESA JupyterLab with your Data Store mounted](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/) | 5–10 min | | Not lose my work | [Save your work where it survives the session](https://idss-mesa.github.io/trainings/tutorials/save-your-work/) | 5–10 min | | Finish for the day | [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/) | 5 min | ## Working with data These tutorials each teach one habit for checking data before you trust a result. They share one small synthetic [practice dataset](https://idss-mesa.github.io/trainings/tutorials/practice-data/) and one notebook, so do the first one first. | I want to… | Tutorial | Time | |---|---|---| | Get a file into a notebook | [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/) | 5 min | | Know what the columns mean | [Read the data dictionary before the data](https://idss-mesa.github.io/trainings/tutorials/read-the-data-dictionary/) | 5 min | | Spot impossible values and blanks | [Check a column's range and missing values](https://idss-mesa.github.io/trainings/tutorials/check-range-and-missing/) | 5 min | | See what the provider doubted | [Tally a quality flag before you trust a number](https://idss-mesa.github.io/trainings/tutorials/tally-a-quality-flag/) | 5 min | | Find repeated and missing days | [Count records per day to find incomplete days](https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/) | 5–10 min | | Join two tables safely | [Reconcile row counts before and after a join](https://idss-mesa.github.io/trainings/tutorials/reconcile-a-join/) | 5–10 min | | Say what a folder of data is | [Write a README for a data folder](https://idss-mesa.github.io/trainings/tutorials/write-a-readme/) | 10 min | | Know which software made a result | [Record the software versions a result depends on](https://idss-mesa.github.io/trainings/tutorials/record-software-versions/) | 5 min | | Hand my notebook to someone | [Leave a notebook someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/leave-a-rerunnable-notebook/) | 5–10 min | | Group hourly data by the right day | [Turn UTC timestamps into local days](https://idss-mesa.github.io/trainings/tutorials/local-days-from-utc/) | 10 min | | Handle several measurements in one column | [Work with a long table, one row per kind of measurement](https://idss-mesa.github.io/trainings/tutorials/work-with-a-long-table/) | 5–10 min | | Run SQL on a Parquet file | [Query a Parquet file with DuckDB from a notebook](https://idss-mesa.github.io/trainings/tutorials/query-parquet-with-duckdb/) | 10 min | | Know which R and packages made a result | [Record the R and package versions a result depends on](https://idss-mesa.github.io/trainings/tutorials/r-record-software-versions/) | 5 min | | Say what a folder of data is, from RStudio | [Write a README for a data folder, from RStudio](https://idss-mesa.github.io/trainings/tutorials/r-write-a-readme/) | 10 min | | Find out if someone else can rerun my R work | [Hand your folder to a colleague and have them rerun it, in R](https://idss-mesa.github.io/trainings/tutorials/r-hand-over-and-rerun/) | 10 min | | Put points on a map in R | [Map point data with sf in MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/) | 10 min | | Test a result I was handed | [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/) | 10 min | | See what a join left out | [Join two tables and keep the unmatched rows visible](https://idss-mesa.github.io/trainings/tutorials/join-and-keep-unmatched/) | 10 min | | Compare gauges that report in different units | [Bring two units onto one scale before comparing](https://idss-mesa.github.io/trainings/tutorials/convert-units-before-comparing/) | 10 min | | Deal with a row that is written twice | [Find and remove a repeated row](https://idss-mesa.github.io/trainings/tutorials/remove-a-repeated-row/) | 5–10 min | | Hand a query to someone else | [Save a query so someone else can run it](https://idss-mesa.github.io/trainings/tutorials/save-a-query/) | 5–10 min | | See an odd value in a chart | [Plot a column to spot odd values](https://idss-mesa.github.io/trainings/tutorials/plot-to-spot-odd-values/) | 10 min | | Make sure a number is not an accident of the method | [Check a result a second way](https://idss-mesa.github.io/trainings/tutorials/check-a-result-two-ways/) | 10 min | | Notice rows a grouping dropped | [Check that the parts add up to the whole](https://idss-mesa.github.io/trainings/tutorials/check-parts-add-up/) | 10 min | | Use one month to question another | [Compare two files that should look alike](https://idss-mesa.github.io/trainings/tutorials/compare-two-files/) | 10 min | | Keep track of what an AI assistant did | [Keep a log of AI-assisted steps](https://idss-mesa.github.io/trainings/tutorials/keep-an-ai-log/) | 5–10 min | ## More in the portal, sharing, and AI agents | I want to… | Tutorial | Time | |---|---|---| | Keep work in one place | [Make a folder in your Data Store](https://idss-mesa.github.io/trainings/tutorials/make-a-folder/) | 5 min | | Give a folder a better name | [Rename a folder in your Data Store](https://idss-mesa.github.io/trainings/tutorials/rename-a-folder/) | 5 min | | Tidy folders away | [Move folders into another folder](https://idss-mesa.github.io/trainings/tutorials/move-folders/) | 5–10 min | | Undo a deletion | [Move a folder to the trash and get it back](https://idss-mesa.github.io/trainings/tutorials/trash-and-restore/) | 10 min | | Put a file from my computer into MESA | [Upload a file from your computer to your Data Store](https://idss-mesa.github.io/trainings/tutorials/upload-a-file/) | 5 min | | Take a file home | [Download a file from your Data Store to your computer](https://idss-mesa.github.io/trainings/tutorials/download-a-file/) | 5 min | | Start a note or a script | [Start a new file in the Data Browser](https://idss-mesa.github.io/trainings/tutorials/make-a-new-file/) | 5 min | | Look through a folder with many items | [Browse a large folder as a sorted list](https://idss-mesa.github.io/trainings/tutorials/browse-a-large-folder/) | 5 min | | See what a colleague recorded about a folder | [Read the metadata on a folder shared with you](https://idss-mesa.github.io/trainings/tutorials/read-shared-metadata/) | 5–10 min | | Take back access I gave | [Stop sharing a folder](https://idss-mesa.github.io/trainings/tutorials/stop-sharing-a-folder/) | 5 min | | Let a colleague see an analysis | [Share an analysis with a collaborator](https://idss-mesa.github.io/trainings/tutorials/share-an-analysis/) | 5 min | | Find people working on my topic | [Find a MESA working group and how to join it](https://idss-mesa.github.io/trainings/tutorials/find-a-working-group/) | 5 min | | Say where my data came from | [Say where your input data came from](https://idss-mesa.github.io/trainings/tutorials/say-where-data-came-from/) | 5–10 min | | Find out if someone else can rerun my work | [Hand your folder to a colleague and have them rerun it](https://idss-mesa.github.io/trainings/tutorials/hand-over-and-rerun/) | 10 min | | Know how much computing time and space I have | [Check your CPU hours and storage](https://idss-mesa.github.io/trainings/tutorials/check-your-usage/) | 5 min | | Read a notebook without starting an app | [Read a notebook in the portal without starting an app](https://idss-mesa.github.io/trainings/tutorials/view-a-notebook/) | 5 min | | See what is in a table before I launch anything | [Look inside a CSV file from the portal](https://idss-mesa.github.io/trainings/tutorials/preview-a-table/) | 5–10 min | | Find something by name | [Search for a file or folder by name](https://idss-mesa.github.io/trainings/tutorials/search-the-data-browser/) | 5 min | | Give an app more memory or time | [Launch an app with the cores, memory, and time you choose](https://idss-mesa.github.io/trainings/tutorials/launch-with-options/) | 5–10 min | | Keep an app from timing out | [Check on a running app and give it more time](https://idss-mesa.github.io/trainings/tutorials/monitor-and-extend/) | 5 min | | Know where things are | [Find your way around the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/find-your-way-around/) | 5 min | | Let a colleague see my folder | [Share a folder with a collaborator](https://idss-mesa.github.io/trainings/tutorials/share-a-folder/) | 5 min | | Say what a folder contains | [Add metadata to a file or folder](https://idss-mesa.github.io/trainings/tutorials/add-metadata/) | 5 min | | Ask an AI agent about my data | [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/) | 10 min | | Use a token safely in a notebook | [Keep tokens and passwords out of saved files](https://idss-mesa.github.io/trainings/tutorials/keep-secrets-out-of-files/) | 5–10 min | ## Ideas, explained An [explainer](https://idss-mesa.github.io/trainings/explainers/) explains one idea in a page, with no steps to follow: what an AI agent is, where a figure in its answer came from, and how to read what it did. ## Practise reading what an AI agent did A [trace card](https://idss-mesa.github.io/trainings/trace-cards/) shows one short run of an AI agent on the practice data, as text, and asks whether its answer is supported. The answer is folded away until you open it. You need no agent, no model, and no key. Start with [How to use the trace cards](https://idss-mesa.github.io/trainings/trace-cards/how-to-use/). ## Bring your own data The same steps work on data of your own. [Bring your own data to MESA](https://idss-mesa.github.io/trainings/bring-your-own-data/) says what to bring, what to leave out, and how to check that it arrived. ## Working in R These use MESA RStudio Geospatial and the same practice data. | I want to… | Tutorial | Time | |---|---|---| | Get a file into R | [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/) | 5–10 min | | See what the provider doubted | [Tally a quality flag in R](https://idss-mesa.github.io/trainings/tutorials/r-tally-a-quality-flag/) | 5 min | | Run SQL on a Parquet file from R | [Query a Parquet file with DuckDB from R](https://idss-mesa.github.io/trainings/tutorials/r-query-parquet-with-duckdb/) | 10 min | | Find an impossible value or a gap in R | [Check a column's range and missing values in R](https://idss-mesa.github.io/trainings/tutorials/r-check-range-and-missing/) | 5 min | | Find doubled and missing days in R | [Count records per day in R](https://idss-mesa.github.io/trainings/tutorials/r-count-records-per-day/) | 5–10 min | | Join two tables in R without losing rows | [Reconcile row counts before and after a join in R](https://idss-mesa.github.io/trainings/tutorials/r-reconcile-a-join/) | 5–10 min | | Hand over R work that runs | [Leave an R script someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/r-leave-a-rerunnable-script/) | 5–10 min | | See which rows a join left out, in R | [Join two tables in R and keep the unmatched rows visible](https://idss-mesa.github.io/trainings/tutorials/r-join-and-keep-unmatched/) | 10 min | | Compare gauges that report in different units, in R | [Bring two units onto one scale in R](https://idss-mesa.github.io/trainings/tutorials/r-convert-units-before-comparing/) | 10 min | | Stop a row being counted twice, in R | [Find and remove a repeated row in R](https://idss-mesa.github.io/trainings/tutorials/r-remove-a-repeated-row/) | 5–10 min | | Hand over a query from R | [Save a query from R so someone else can run it](https://idss-mesa.github.io/trainings/tutorials/r-save-a-query/) | 5–10 min | | Know what a column means before using it, in R | [Read the data dictionary before the data, in R](https://idss-mesa.github.io/trainings/tutorials/r-read-the-data-dictionary/) | 5 min | | Put evening rain on the right day, in R | [Turn UTC timestamps into local days in R](https://idss-mesa.github.io/trainings/tutorials/r-local-days-from-utc/) | 10 min | | Handle one row per kind of measurement, in R | [Work with a long table in R](https://idss-mesa.github.io/trainings/tutorials/r-work-with-a-long-table/) | 5–10 min | | See an odd value in a chart, in R | [Plot a column to spot odd values in R](https://idss-mesa.github.io/trainings/tutorials/r-plot-to-spot-odd-values/) | 10 min | | Make sure a number is not an accident of the method, in R | [Check a result a second way in R](https://idss-mesa.github.io/trainings/tutorials/r-check-a-result-two-ways/) | 10 min | | Notice rows a tally dropped, in R | [Check that the parts add up to the whole in R](https://idss-mesa.github.io/trainings/tutorials/r-check-parts-add-up/) | 10 min | | Use one month to question another, in R | [Compare two files that should look alike in R](https://idss-mesa.github.io/trainings/tutorials/r-compare-two-files/) | 10 min | | Put points on a map | [Map point data with sf in MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/) | 10 min | ## The other MESA apps One first task in each of the apps besides JupyterLab and RStudio. | I want to… | Tutorial | Time | |---|---|---| | Fetch a file from the web into my Data Store | [Download a file from the web into your Data Store with MESA Cloud Shell](https://idss-mesa.github.io/trainings/tutorials/cloud-shell-download/) | 5–10 min | | Write and run a script | [Write and run a Python script in MESA VS Code](https://idss-mesa.github.io/trainings/tutorials/vscode-run-a-script/) | 10 min | | Use a program that needs a desktop | [Open a file from your Data Store in a desktop program](https://idss-mesa.github.io/trainings/tutorials/desktop-open-a-file/) | 10 min | | Leave a long command running | [Keep a command running in MESA Cloud Shell after you close the tab](https://idss-mesa.github.io/trainings/tutorials/cloud-shell-keep-running/) | 10 min | | Find every file that mentions a value | [Find a value in every file of a folder with MESA VS Code](https://idss-mesa.github.io/trainings/tutorials/vscode-find-in-folder/) | 5 min | | Run a command beside a desktop program | [Open a terminal in a Data Store folder on the MESA desktop](https://idss-mesa.github.io/trainings/tutorials/desktop-open-a-terminal/) | 5–10 min | ## How a tutorial is laid out Every tutorial has the same six parts, in the same order: 1. **You will**: what you have at the end. 2. **You need**: what to have ready, with links. 3. **Steps**: one action each, followed by what you should see. 4. **Check it worked**: one result that tells success from failure. 5. **If it didn't**: the most likely slip, described by what you see. 6. **Next**: the tutorials that follow, and the documentation page to read for more. A tutorial never repeats the documentation. For the full picture of a screen or a feature, follow its **Reference** link to the [MESA documentation](https://idss-mesa.github.io/docs/). ## More about MESA - [MESA website](https://idss-mesa.github.io/): what MESA is and who builds it - [MESA documentation](https://idss-mesa.github.io/docs/): guides to the portal, the apps, and the MESA tools for AI agents - [MESA Portal](https://mesa.cyverse.org): where the tutorials happen ## Use and reuse The tutorials are licensed [CC BY 4.0](https://idss-mesa.github.io/trainings/about/license/): copy and adapt them, with credit. To fix one or write a new one, see [Contribute a tutorial](https://idss-mesa.github.io/trainings/contributing/). ## How AI was used The pages on this site were drafted with an AI assistant and are drafts until a person has followed them. [How AI was used](https://idss-mesa.github.io/trainings/about/ai-disclosure/) says what that covers and how to tell, page by page. ## For AI agents This site is an [Open Knowledge Format (OKF) v0.2](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md) knowledge bundle with the same conventions as the MESA documentation. Start at [`https://idss-mesa.github.io/trainings/llms.txt`](https://idss-mesa.github.io/trainings/llms.txt) or read [For AI agents](https://idss-mesa.github.io/trainings/about/ai-agents/). ---8<--- https://idss-mesa.github.io/trainings/pathways/new-to-mesa/ --- type: Guide title: "New to MESA" description: "Sign in, start a notebook, and keep what you make: 3 tutorials to start with, 15 to 25 minutes in all, and more for when you have time." tags: [pathway, new-to-mesa] status: draft generated: { by: "gen-pathways/1", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-11T00:00:00Z" sources: - id: pathways resource: "https://github.com/idss-mesa/trainings/blob/main/data/pathways.yml" title: "MESA Trainings pathway data" author: "team:idss-mesa" --- # New to MESA Sign in, start a notebook, and keep what you make. **The essentials: 3 tutorials, 15 to 25 minutes in all.** Take them in order, or start wherever your question is. Nothing is locked. Each point also lists what to take if you have more time. !!! warning "These tutorials are drafts" Each tutorial says at the top how far it has been checked. ## Orient and navigate *Work in MESA.* You can get into MESA, find data, run an app, and keep what you make. 1. [Sign in to the MESA Portal with a CyVerse account](https://idss-mesa.github.io/trainings/tutorials/sign-in/) (5 minutes) 2. [Launch MESA JupyterLab with your Data Store mounted](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/) (5 to 10 minutes) 3. [Save your work where it survives the session](https://idss-mesa.github.io/trainings/tutorials/save-your-work/) (5 to 10 minutes) If you have more time: - [Ask CyVerse for access to interactive apps](https://idss-mesa.github.io/trainings/tutorials/request-app-access/) (5 minutes) - [Find your way around the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/find-your-way-around/) (5 minutes) - [Find MESA's community data in the Data Browser](https://idss-mesa.github.io/trainings/tutorials/find-community-data/) (5 minutes) - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/) (5 minutes) ## Next - [Choose another pathway](https://idss-mesa.github.io/trainings/pathways/) - [Every tutorial, by pathway point](https://idss-mesa.github.io/trainings/pathway/) ---8<--- https://idss-mesa.github.io/trainings/pathways/get-ready-for-a-session/ --- type: Guide title: "Get ready for a hands-on session" description: "Arrive signed in, with an app that starts and the practice data loaded: 4 tutorials to start with, 20 to 25 minutes in all, and more for when you have time." tags: [pathway, get-ready-for-a-session] status: draft generated: { by: "gen-pathways/1", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-11T00:00:00Z" sources: - id: pathways resource: "https://github.com/idss-mesa/trainings/blob/main/data/pathways.yml" title: "MESA Trainings pathway data" author: "team:idss-mesa" --- # Get ready for a hands-on session Arrive signed in, with an app that starts and the practice data loaded. **The essentials: 4 tutorials, 20 to 25 minutes in all.** Take them in order, or start wherever your question is. Nothing is locked. Each point also lists what to take if you have more time. Do the first two at least two days before. A new CyVerse account has to ask once for access to apps, and CyVerse says it answers within one to two days. "Ask CyVerse for access to interactive apps", under the first point, shows how. !!! warning "These tutorials are drafts" Each tutorial says at the top how far it has been checked. ## Orient and navigate *Work in MESA.* You can get into MESA, find data, run an app, and keep what you make. 1. [Sign in to the MESA Portal with a CyVerse account](https://idss-mesa.github.io/trainings/tutorials/sign-in/) (5 minutes) 2. [Launch MESA JupyterLab with your Data Store mounted](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/) (5 to 10 minutes) If you have more time: - [Ask CyVerse for access to interactive apps](https://idss-mesa.github.io/trainings/tutorials/request-app-access/) (5 minutes) - [Find your way around the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/find-your-way-around/) (5 minutes) - [Save your work where it survives the session](https://idss-mesa.github.io/trainings/tutorials/save-your-work/) (5 to 10 minutes) - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/) (5 minutes) ## Run and understand *Understand data.* You can say what a dataset holds and where it is incomplete or doubtful, before you compute with it. 1. [Practice data: five invented rain gauges](https://idss-mesa.github.io/trainings/tutorials/practice-data/) (5 minutes) 2. [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/) (5 minutes) If you have more time: - [Read the data dictionary before the data](https://idss-mesa.github.io/trainings/tutorials/read-the-data-dictionary/) (5 minutes) - [Check a column's range and missing values](https://idss-mesa.github.io/trainings/tutorials/check-range-and-missing/) (5 minutes) - [Tally a quality flag before you trust a number](https://idss-mesa.github.io/trainings/tutorials/tally-a-quality-flag/) (5 minutes) ## Query and connect You can ask questions across files and tables, and show that combining them did what you meant. If you have more time: - [Reconcile row counts before and after a join](https://idss-mesa.github.io/trainings/tutorials/reconcile-a-join/) (5 to 10 minutes) ## Explore and verify *Explore with AI and verify.* You can work with an AI assistant and test what it tells you against the data. If you have more time: - [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/) (10 minutes) ## Preserve and share You can leave work that someone else can find, understand, and run again. If you have more time: - [Leave a notebook someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/leave-a-rerunnable-notebook/) (5 to 10 minutes) ## Next - [Choose another pathway](https://idss-mesa.github.io/trainings/pathways/) - [Every tutorial, by pathway point](https://idss-mesa.github.io/trainings/pathway/) ---8<--- https://idss-mesa.github.io/trainings/pathways/check-a-dataset/ --- type: Guide title: "Check a dataset before you trust it" description: "Find out what a dataset holds and where it is incomplete or doubtful: 5 tutorials to start with, 25 minutes in all, and more for when you have time." tags: [pathway, check-a-dataset] status: draft generated: { by: "gen-pathways/1", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: pathways resource: "https://github.com/idss-mesa/trainings/blob/main/data/pathways.yml" title: "MESA Trainings pathway data" author: "team:idss-mesa" --- # Check a dataset before you trust it Find out what a dataset holds and where it is incomplete or doubtful. **The essentials: 5 tutorials, 25 minutes in all.** Take them in order, or start wherever your question is. Nothing is locked. Each point also lists what to take if you have more time. New to the portal? Take [New to MESA](https://idss-mesa.github.io/trainings/pathways/new-to-mesa/) first. !!! warning "These tutorials are drafts" Each tutorial says at the top how far it has been checked. ## Run and understand *Understand data.* You can say what a dataset holds and where it is incomplete or doubtful, before you compute with it. 1. [Practice data: five invented rain gauges](https://idss-mesa.github.io/trainings/tutorials/practice-data/) (5 minutes) 2. [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/) (5 minutes) 3. [Read the data dictionary before the data](https://idss-mesa.github.io/trainings/tutorials/read-the-data-dictionary/) (5 minutes) 4. [Check a column's range and missing values](https://idss-mesa.github.io/trainings/tutorials/check-range-and-missing/) (5 minutes) 5. [Tally a quality flag before you trust a number](https://idss-mesa.github.io/trainings/tutorials/tally-a-quality-flag/) (5 minutes) If you have more time: - [Count records per day to find incomplete days](https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/) (5 to 10 minutes) - [Turn UTC timestamps into local days](https://idss-mesa.github.io/trainings/tutorials/local-days-from-utc/) (10 minutes) - [Work with a long table, one row per kind of measurement](https://idss-mesa.github.io/trainings/tutorials/work-with-a-long-table/) (5 to 10 minutes) ## Query and connect You can ask questions across files and tables, and show that combining them did what you meant. If you have more time: - [Reconcile row counts before and after a join](https://idss-mesa.github.io/trainings/tutorials/reconcile-a-join/) (5 to 10 minutes) - [Query a Parquet file with DuckDB from a notebook](https://idss-mesa.github.io/trainings/tutorials/query-parquet-with-duckdb/) (10 minutes) - [Bring two units onto one scale before comparing](https://idss-mesa.github.io/trainings/tutorials/convert-units-before-comparing/) (10 minutes) - [Find and remove a repeated row](https://idss-mesa.github.io/trainings/tutorials/remove-a-repeated-row/) (5 to 10 minutes) - [Join two tables and keep the unmatched rows visible](https://idss-mesa.github.io/trainings/tutorials/join-and-keep-unmatched/) (10 minutes) ## Explore and verify *Explore with AI and verify.* You can work with an AI assistant and test what it tells you against the data. If you have more time: - [Plot a column to spot odd values](https://idss-mesa.github.io/trainings/tutorials/plot-to-spot-odd-values/) (10 minutes) - [Compare two files that should look alike](https://idss-mesa.github.io/trainings/tutorials/compare-two-files/) (10 minutes) - [Check that the parts add up to the whole](https://idss-mesa.github.io/trainings/tutorials/check-parts-add-up/) (10 minutes) - [Check a result a second way](https://idss-mesa.github.io/trainings/tutorials/check-a-result-two-ways/) (10 minutes) ## Next - [Choose another pathway](https://idss-mesa.github.io/trainings/pathways/) - [Every tutorial, by pathway point](https://idss-mesa.github.io/trainings/pathway/) ---8<--- https://idss-mesa.github.io/trainings/pathways/work-in-r/ --- type: Guide title: "Work in R" description: "Load the practice data in MESA RStudio Geospatial and check its flags: 2 tutorials to start with, 10 to 15 minutes in all, and more for when you have time." tags: [pathway, work-in-r] status: draft generated: { by: "gen-pathways/1", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: pathways resource: "https://github.com/idss-mesa/trainings/blob/main/data/pathways.yml" title: "MESA Trainings pathway data" author: "team:idss-mesa" --- # Work in R Load the practice data in MESA RStudio Geospatial and check its flags. **The essentials: 2 tutorials, 10 to 15 minutes in all.** Take them in order, or start wherever your question is. Nothing is locked. Each point also lists what to take if you have more time. New to the portal? Take [New to MESA](https://idss-mesa.github.io/trainings/pathways/new-to-mesa/) first. !!! warning "These tutorials are drafts" Each tutorial says at the top how far it has been checked. ## Run and understand *Understand data.* You can say what a dataset holds and where it is incomplete or doubtful, before you compute with it. 1. [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/) (5 to 10 minutes) 2. [Tally a quality flag in R](https://idss-mesa.github.io/trainings/tutorials/r-tally-a-quality-flag/) (5 minutes) If you have more time: - [Read the data dictionary before the data, in R](https://idss-mesa.github.io/trainings/tutorials/r-read-the-data-dictionary/) (5 minutes) - [Check a column's range and missing values in R](https://idss-mesa.github.io/trainings/tutorials/r-check-range-and-missing/) (5 minutes) - [Count records per day in R](https://idss-mesa.github.io/trainings/tutorials/r-count-records-per-day/) (5 to 10 minutes) - [Map point data with sf in MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/) (10 minutes) ## Query and connect You can ask questions across files and tables, and show that combining them did what you meant. If you have more time: - [Reconcile row counts before and after a join in R](https://idss-mesa.github.io/trainings/tutorials/r-reconcile-a-join/) (5 to 10 minutes) - [Query a Parquet file with DuckDB from R](https://idss-mesa.github.io/trainings/tutorials/r-query-parquet-with-duckdb/) (10 minutes) - [Join two tables in R and keep the unmatched rows visible](https://idss-mesa.github.io/trainings/tutorials/r-join-and-keep-unmatched/) (10 minutes) - [Bring two units onto one scale in R](https://idss-mesa.github.io/trainings/tutorials/r-convert-units-before-comparing/) (10 minutes) - [Find and remove a repeated row in R](https://idss-mesa.github.io/trainings/tutorials/r-remove-a-repeated-row/) (5 to 10 minutes) - [Save a query from R so someone else can run it](https://idss-mesa.github.io/trainings/tutorials/r-save-a-query/) (5 to 10 minutes) ## Explore and verify *Explore with AI and verify.* You can work with an AI assistant and test what it tells you against the data. If you have more time: - [Plot a column to spot odd values in R](https://idss-mesa.github.io/trainings/tutorials/r-plot-to-spot-odd-values/) (10 minutes) - [Compare two files that should look alike in R](https://idss-mesa.github.io/trainings/tutorials/r-compare-two-files/) (10 minutes) - [Check that the parts add up to the whole in R](https://idss-mesa.github.io/trainings/tutorials/r-check-parts-add-up/) (10 minutes) - [Check a result a second way in R](https://idss-mesa.github.io/trainings/tutorials/r-check-a-result-two-ways/) (10 minutes) ## Preserve and share You can leave work that someone else can find, understand, and run again. If you have more time: - [Leave an R script someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/r-leave-a-rerunnable-script/) (5 to 10 minutes) - [Write a README for a data folder, from RStudio](https://idss-mesa.github.io/trainings/tutorials/r-write-a-readme/) (10 minutes) - [Record the R and package versions a result depends on](https://idss-mesa.github.io/trainings/tutorials/r-record-software-versions/) (5 minutes) - [Hand your folder to a colleague and have them rerun it, in R](https://idss-mesa.github.io/trainings/tutorials/r-hand-over-and-rerun/) (10 minutes) ## Next - [Choose another pathway](https://idss-mesa.github.io/trainings/pathways/) - [Every tutorial, by pathway point](https://idss-mesa.github.io/trainings/pathway/) ---8<--- https://idss-mesa.github.io/trainings/pathways/use-an-ai-agent/ --- type: Guide title: "Use an AI agent and check what it says" description: "Test what an AI assistant tells you against the data, then start an agent of your own: 3 tutorials to start with, 20 minutes in all, and more for when you have time." tags: [pathway, use-an-ai-agent] status: draft generated: { by: "gen-pathways/1", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: pathways resource: "https://github.com/idss-mesa/trainings/blob/main/data/pathways.yml" title: "MESA Trainings pathway data" author: "team:idss-mesa" --- # Use an AI agent and check what it says Test what an AI assistant tells you against the data, then start an agent of your own. **The essentials: 3 tutorials, 20 minutes in all.** Take them in order, or start wherever your question is. Nothing is locked. Each point also lists what to take if you have more time. New to the portal? Take [New to MESA](https://idss-mesa.github.io/trainings/pathways/new-to-mesa/) first. !!! warning "These tutorials are drafts" Each tutorial says at the top how far it has been checked. ## Run and understand *Understand data.* You can say what a dataset holds and where it is incomplete or doubtful, before you compute with it. 1. [Practice data: five invented rain gauges](https://idss-mesa.github.io/trainings/tutorials/practice-data/) (5 minutes) 2. [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/) (5 minutes) If you have more time: - [Tally a quality flag before you trust a number](https://idss-mesa.github.io/trainings/tutorials/tally-a-quality-flag/) (5 minutes) ## Query and connect You can ask questions across files and tables, and show that combining them did what you meant. If you have more time: - [Keep tokens and passwords out of saved files](https://idss-mesa.github.io/trainings/tutorials/keep-secrets-out-of-files/) (5 to 10 minutes) ## Explore and verify *Explore with AI and verify.* You can work with an AI assistant and test what it tells you against the data. 1. [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/) (10 minutes) If you have more time: - [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/) (10 minutes) - [See which tool servers your agent can use](https://idss-mesa.github.io/trainings/tutorials/see-an-agents-tools/) (5 minutes) - [Check what an agent may change before you let it](https://idss-mesa.github.io/trainings/tutorials/check-what-an-agent-may-change/) (10 minutes) - [Keep a log of AI-assisted steps](https://idss-mesa.github.io/trainings/tutorials/keep-an-ai-log/) (5 to 10 minutes) - [Read back what an agent ran](https://idss-mesa.github.io/trainings/tutorials/read-what-an-agent-ran/) (5 to 10 minutes) - [Ask an agent for a query, then run it yourself](https://idss-mesa.github.io/trainings/tutorials/ask-for-a-query-then-run-it/) (10 minutes) ## Ideas and practice Pages that are not tutorials: an idea to read, or a run to judge. They do not count toward the essentials or toward your progress. **Read the idea** - [What an agent is, and is not](https://idss-mesa.github.io/trainings/explainers/what-an-agent-is/) - [How an agent reaches data: tools and MCP](https://idss-mesa.github.io/trainings/explainers/tools-and-mcp/) - [Recalled or retrieved](https://idss-mesa.github.io/trainings/explainers/recalled-or-retrieved/) - [Reading what an agent did](https://idss-mesa.github.io/trainings/explainers/reading-what-an-agent-did/) - [When to stop and ask](https://idss-mesa.github.io/trainings/explainers/when-to-stop-and-ask/) **Practise judging a run** - [How to use the trace cards](https://idss-mesa.github.io/trainings/trace-cards/how-to-use/) - [Trace card 1: the wettest gauge in July](https://idss-mesa.github.io/trainings/trace-cards/card-1-wettest-gauge/) - [Trace card 2: G01's missing days](https://idss-mesa.github.io/trainings/trace-cards/card-2-missing-days/) - [Trace card 4: the wettest gauge, a second run](https://idss-mesa.github.io/trainings/trace-cards/card-4-wettest-gauge/) - [Trace card 5: the wettest gauge, a third run](https://idss-mesa.github.io/trainings/trace-cards/card-5-wettest-gauge/) - [Trace card 7: G03's July total](https://idss-mesa.github.io/trainings/trace-cards/card-7-g03-total/) - [Trace card 9: the wettest gauge, a recorded run](https://idss-mesa.github.io/trainings/trace-cards/card-9-wettest-gauge-recorded/) ## Next - [Choose another pathway](https://idss-mesa.github.io/trainings/pathways/) - [Every tutorial, by pathway point](https://idss-mesa.github.io/trainings/pathway/) ---8<--- https://idss-mesa.github.io/trainings/pathways/leave-work-others-can-rerun/ --- type: Guide title: "Leave work others can rerun" description: "Describe your work and leave a notebook that someone else can run again: 2 tutorials to start with, 15 to 20 minutes in all, and more for when you have time." tags: [pathway, leave-work-others-can-rerun] status: draft generated: { by: "gen-pathways/1", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: pathways resource: "https://github.com/idss-mesa/trainings/blob/main/data/pathways.yml" title: "MESA Trainings pathway data" author: "team:idss-mesa" --- # Leave work others can rerun Describe your work and leave a notebook that someone else can run again. **The essentials: 2 tutorials, 15 to 20 minutes in all.** Take them in order, or start wherever your question is. Nothing is locked. Each point also lists what to take if you have more time. New to the portal? Take [New to MESA](https://idss-mesa.github.io/trainings/pathways/new-to-mesa/) first. !!! warning "These tutorials are drafts" Each tutorial says at the top how far it has been checked. ## Preserve and share You can leave work that someone else can find, understand, and run again. 1. [Write a README for a data folder](https://idss-mesa.github.io/trainings/tutorials/write-a-readme/) (10 minutes) 2. [Leave a notebook someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/leave-a-rerunnable-notebook/) (5 to 10 minutes) If you have more time: - [Add metadata to a file or folder](https://idss-mesa.github.io/trainings/tutorials/add-metadata/) (5 minutes) - [Describe a folder with DataCite fields](https://idss-mesa.github.io/trainings/tutorials/describe-with-datacite-fields/) (5 to 10 minutes) - [Add Dublin Core fields to a folder](https://idss-mesa.github.io/trainings/tutorials/describe-with-dublin-core-fields/) (5 minutes) - [Record where and when data was collected, with EML fields](https://idss-mesa.github.io/trainings/tutorials/describe-with-eml-fields/) (5 to 10 minutes) - [Make a folder's metadata valid Croissant](https://idss-mesa.github.io/trainings/tutorials/make-metadata-valid-croissant/) (5 to 10 minutes) - [Tag a folder with an ontology term](https://idss-mesa.github.io/trainings/tutorials/tag-with-an-ontology-term/) (5 minutes) - [Record the software versions a result depends on](https://idss-mesa.github.io/trainings/tutorials/record-software-versions/) (5 minutes) - [Say where your input data came from](https://idss-mesa.github.io/trainings/tutorials/say-where-data-came-from/) (5 to 10 minutes) - [State what AI did in your analysis](https://idss-mesa.github.io/trainings/tutorials/state-what-ai-did/) (5 to 10 minutes) - [Hand your folder to a colleague and have them rerun it](https://idss-mesa.github.io/trainings/tutorials/hand-over-and-rerun/) (10 minutes) ## Query and connect You can ask questions across files and tables, and show that combining them did what you meant. If you have more time: - [Save a query so someone else can run it](https://idss-mesa.github.io/trainings/tutorials/save-a-query/) (5 to 10 minutes) ## Orient and navigate *Work in MESA.* You can get into MESA, find data, run an app, and keep what you make. If you have more time: - [Share a folder with a collaborator](https://idss-mesa.github.io/trainings/tutorials/share-a-folder/) (5 minutes) - [Read the metadata on a folder shared with you](https://idss-mesa.github.io/trainings/tutorials/read-shared-metadata/) (5 to 10 minutes) - [Stop sharing a folder](https://idss-mesa.github.io/trainings/tutorials/stop-sharing-a-folder/) (5 minutes) ## Next - [Choose another pathway](https://idss-mesa.github.io/trainings/pathways/) - [Every tutorial, by pathway point](https://idss-mesa.github.io/trainings/pathway/) ---8<--- https://idss-mesa.github.io/trainings/pathway/ --- type: Reference title: "Every tutorial, by pathway point" description: "Every MESA tutorial under the five points of the learning pathway, from finding your way around to sharing work others can rerun, with the time each takes." tags: [pathway, tutorials, getting-started] status: draft generated: { by: "gen-pathways/1", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-11T00:00:00Z" sources: - id: pathways resource: "https://github.com/idss-mesa/trainings/blob/main/data/pathways.yml" title: "MESA Trainings pathway data" author: "team:idss-mesa" - id: docs resource: "https://idss-mesa.github.io/docs/" title: "MESA documentation" author: "team:idss-mesa" --- # Every tutorial, by pathway point The tutorials build five abilities, one at each point of the MESA learning pathway. Each point builds on the one before, but every tutorial says what it needs, so you can start wherever your question is. This page lists them all. If you have a goal in mind, a pathway is a shorter route: - [New to MESA](https://idss-mesa.github.io/trainings/pathways/new-to-mesa/): 3 tutorials, 15 to 25 minutes - [Get ready for a hands-on session](https://idss-mesa.github.io/trainings/pathways/get-ready-for-a-session/): 4 tutorials, 20 to 25 minutes - [Check a dataset before you trust it](https://idss-mesa.github.io/trainings/pathways/check-a-dataset/): 5 tutorials, 25 minutes - [Work in R](https://idss-mesa.github.io/trainings/pathways/work-in-r/): 2 tutorials, 10 to 15 minutes - [Use an AI agent and check what it says](https://idss-mesa.github.io/trainings/pathways/use-an-ai-agent/): 3 tutorials, 20 minutes - [Leave work others can rerun](https://idss-mesa.github.io/trainings/pathways/leave-work-others-can-rerun/): 2 tutorials, 15 to 20 minutes !!! warning "These tutorials are drafts" Each tutorial says at the top how far it has been checked. ## 1. Orient and navigate *Work in MESA.* You can get into MESA, find data, run an app, and keep what you make. 32 tutorials, 180 to 220 minutes in all. 1. [Sign in to the MESA Portal with a CyVerse account](https://idss-mesa.github.io/trainings/tutorials/sign-in/) (5 minutes) 2. [Find your way around the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/find-your-way-around/) (5 minutes) 3. [Find MESA's community data in the Data Browser](https://idss-mesa.github.io/trainings/tutorials/find-community-data/) (5 minutes) 4. [Ask CyVerse for access to interactive apps](https://idss-mesa.github.io/trainings/tutorials/request-app-access/) (5 minutes) 5. [Launch MESA JupyterLab with your Data Store mounted](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/) (5 to 10 minutes) 6. [Save your work where it survives the session](https://idss-mesa.github.io/trainings/tutorials/save-your-work/) (5 to 10 minutes) 7. [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/) (5 minutes) ### Organise folders 1. [Make a folder in your Data Store](https://idss-mesa.github.io/trainings/tutorials/make-a-folder/) (5 minutes) 2. [Rename a folder in your Data Store](https://idss-mesa.github.io/trainings/tutorials/rename-a-folder/) (5 minutes) 3. [Move folders into another folder](https://idss-mesa.github.io/trainings/tutorials/move-folders/) (5 to 10 minutes) 4. [Move a folder to the trash and get it back](https://idss-mesa.github.io/trainings/tutorials/trash-and-restore/) (10 minutes) ### Files in and out 1. [Upload a file from your computer to your Data Store](https://idss-mesa.github.io/trainings/tutorials/upload-a-file/) (5 minutes) 2. [Download a file from your Data Store to your computer](https://idss-mesa.github.io/trainings/tutorials/download-a-file/) (5 minutes) 3. [Start a new file in the Data Browser](https://idss-mesa.github.io/trainings/tutorials/make-a-new-file/) (5 minutes) ### Find and look 1. [Search for a file or folder by name](https://idss-mesa.github.io/trainings/tutorials/search-the-data-browser/) (5 minutes) 2. [Browse a large folder as a sorted list](https://idss-mesa.github.io/trainings/tutorials/browse-a-large-folder/) (5 minutes) 3. [Read a notebook in the portal without starting an app](https://idss-mesa.github.io/trainings/tutorials/view-a-notebook/) (5 minutes) 4. [Look inside a CSV file from the portal](https://idss-mesa.github.io/trainings/tutorials/preview-a-table/) (5 to 10 minutes) ### Run apps 1. [Launch an app with the cores, memory, and time you choose](https://idss-mesa.github.io/trainings/tutorials/launch-with-options/) (5 to 10 minutes) 2. [Check on a running app and give it more time](https://idss-mesa.github.io/trainings/tutorials/monitor-and-extend/) (5 minutes) 3. [Check your CPU hours and storage](https://idss-mesa.github.io/trainings/tutorials/check-your-usage/) (5 minutes) ### The other MESA apps 1. [Download a file from the web into your Data Store with MESA Cloud Shell](https://idss-mesa.github.io/trainings/tutorials/cloud-shell-download/) (5 to 10 minutes) 2. [Keep a command running in MESA Cloud Shell after you close the tab](https://idss-mesa.github.io/trainings/tutorials/cloud-shell-keep-running/) (10 minutes) 3. [Write and run a Python script in MESA VS Code](https://idss-mesa.github.io/trainings/tutorials/vscode-run-a-script/) (10 minutes) 4. [Find a value in every file of a folder with MESA VS Code](https://idss-mesa.github.io/trainings/tutorials/vscode-find-in-folder/) (5 minutes) 5. [Open a file from your Data Store in a desktop program](https://idss-mesa.github.io/trainings/tutorials/desktop-open-a-file/) (10 minutes) 6. [Open a terminal in a Data Store folder on the MESA desktop](https://idss-mesa.github.io/trainings/tutorials/desktop-open-a-terminal/) (5 to 10 minutes) ### Share 1. [Share a folder with a collaborator](https://idss-mesa.github.io/trainings/tutorials/share-a-folder/) (5 minutes) 2. [Read the metadata on a folder shared with you](https://idss-mesa.github.io/trainings/tutorials/read-shared-metadata/) (5 to 10 minutes) 3. [Stop sharing a folder](https://idss-mesa.github.io/trainings/tutorials/stop-sharing-a-folder/) (5 minutes) 4. [Share an analysis with a collaborator](https://idss-mesa.github.io/trainings/tutorials/share-an-analysis/) (5 minutes) 5. [Find a MESA working group and how to join it](https://idss-mesa.github.io/trainings/tutorials/find-a-working-group/) (5 minutes) ## 2. Run and understand *Understand data.* You can say what a dataset holds and where it is incomplete or doubtful, before you compute with it. 16 tutorials, 95 to 120 minutes in all. 1. [Practice data: five invented rain gauges](https://idss-mesa.github.io/trainings/tutorials/practice-data/) (5 minutes) 2. [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/) (5 minutes) 3. [Read the data dictionary before the data](https://idss-mesa.github.io/trainings/tutorials/read-the-data-dictionary/) (5 minutes) 4. [Check a column's range and missing values](https://idss-mesa.github.io/trainings/tutorials/check-range-and-missing/) (5 minutes) 5. [Tally a quality flag before you trust a number](https://idss-mesa.github.io/trainings/tutorials/tally-a-quality-flag/) (5 minutes) 6. [Count records per day to find incomplete days](https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/) (5 to 10 minutes) ### More kinds of table 1. [Turn UTC timestamps into local days](https://idss-mesa.github.io/trainings/tutorials/local-days-from-utc/) (10 minutes) 2. [Work with a long table, one row per kind of measurement](https://idss-mesa.github.io/trainings/tutorials/work-with-a-long-table/) (5 to 10 minutes) ### In R, in MESA RStudio Geospatial 1. [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/) (5 to 10 minutes) 2. [Read the data dictionary before the data, in R](https://idss-mesa.github.io/trainings/tutorials/r-read-the-data-dictionary/) (5 minutes) 3. [Check a column's range and missing values in R](https://idss-mesa.github.io/trainings/tutorials/r-check-range-and-missing/) (5 minutes) 4. [Tally a quality flag in R](https://idss-mesa.github.io/trainings/tutorials/r-tally-a-quality-flag/) (5 minutes) 5. [Count records per day in R](https://idss-mesa.github.io/trainings/tutorials/r-count-records-per-day/) (5 to 10 minutes) 6. [Map point data with sf in MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/) (10 minutes) ### More kinds of table, in R 1. [Turn UTC timestamps into local days in R](https://idss-mesa.github.io/trainings/tutorials/r-local-days-from-utc/) (10 minutes) 2. [Work with a long table in R](https://idss-mesa.github.io/trainings/tutorials/r-work-with-a-long-table/) (5 to 10 minutes) ## 3. Query and connect You can ask questions across files and tables, and show that combining them did what you meant. 13 tutorials, 95 to 130 minutes in all. 1. [Query a Parquet file with DuckDB from a notebook](https://idss-mesa.github.io/trainings/tutorials/query-parquet-with-duckdb/) (10 minutes) 2. [Reconcile row counts before and after a join](https://idss-mesa.github.io/trainings/tutorials/reconcile-a-join/) (5 to 10 minutes) 3. [Keep tokens and passwords out of saved files](https://idss-mesa.github.io/trainings/tutorials/keep-secrets-out-of-files/) (5 to 10 minutes) 4. [Query a Parquet file with DuckDB from R](https://idss-mesa.github.io/trainings/tutorials/r-query-parquet-with-duckdb/) (10 minutes) 5. [Reconcile row counts before and after a join in R](https://idss-mesa.github.io/trainings/tutorials/r-reconcile-a-join/) (5 to 10 minutes) ### Combine and clean 1. [Join two tables and keep the unmatched rows visible](https://idss-mesa.github.io/trainings/tutorials/join-and-keep-unmatched/) (10 minutes) 2. [Bring two units onto one scale before comparing](https://idss-mesa.github.io/trainings/tutorials/convert-units-before-comparing/) (10 minutes) 3. [Find and remove a repeated row](https://idss-mesa.github.io/trainings/tutorials/remove-a-repeated-row/) (5 to 10 minutes) 4. [Save a query so someone else can run it](https://idss-mesa.github.io/trainings/tutorials/save-a-query/) (5 to 10 minutes) ### Combine and clean, in R 1. [Join two tables in R and keep the unmatched rows visible](https://idss-mesa.github.io/trainings/tutorials/r-join-and-keep-unmatched/) (10 minutes) 2. [Bring two units onto one scale in R](https://idss-mesa.github.io/trainings/tutorials/r-convert-units-before-comparing/) (10 minutes) 3. [Find and remove a repeated row in R](https://idss-mesa.github.io/trainings/tutorials/r-remove-a-repeated-row/) (5 to 10 minutes) 4. [Save a query from R so someone else can run it](https://idss-mesa.github.io/trainings/tutorials/r-save-a-query/) (5 to 10 minutes) ## 4. Explore and verify *Explore with AI and verify.* You can work with an AI assistant and test what it tells you against the data. 15 tutorials, 135 to 145 minutes in all. 1. [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/) (10 minutes) 2. [See which tool servers your agent can use](https://idss-mesa.github.io/trainings/tutorials/see-an-agents-tools/) (5 minutes) 3. [Check what an agent may change before you let it](https://idss-mesa.github.io/trainings/tutorials/check-what-an-agent-may-change/) (10 minutes) 4. [Read back what an agent ran](https://idss-mesa.github.io/trainings/tutorials/read-what-an-agent-ran/) (5 to 10 minutes) 5. [Ask an agent for a query, then run it yourself](https://idss-mesa.github.io/trainings/tutorials/ask-for-a-query-then-run-it/) (10 minutes) 6. [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/) (10 minutes) 7. [Keep a log of AI-assisted steps](https://idss-mesa.github.io/trainings/tutorials/keep-an-ai-log/) (5 to 10 minutes) ### Checks for any result 1. [Plot a column to spot odd values](https://idss-mesa.github.io/trainings/tutorials/plot-to-spot-odd-values/) (10 minutes) 2. [Check a result a second way](https://idss-mesa.github.io/trainings/tutorials/check-a-result-two-ways/) (10 minutes) 3. [Check that the parts add up to the whole](https://idss-mesa.github.io/trainings/tutorials/check-parts-add-up/) (10 minutes) 4. [Compare two files that should look alike](https://idss-mesa.github.io/trainings/tutorials/compare-two-files/) (10 minutes) ### Checks for any result, in R 1. [Plot a column to spot odd values in R](https://idss-mesa.github.io/trainings/tutorials/r-plot-to-spot-odd-values/) (10 minutes) 2. [Check a result a second way in R](https://idss-mesa.github.io/trainings/tutorials/r-check-a-result-two-ways/) (10 minutes) 3. [Check that the parts add up to the whole in R](https://idss-mesa.github.io/trainings/tutorials/r-check-parts-add-up/) (10 minutes) 4. [Compare two files that should look alike in R](https://idss-mesa.github.io/trainings/tutorials/r-compare-two-files/) (10 minutes) ## 5. Preserve and share You can leave work that someone else can find, understand, and run again. 16 tutorials, 100 to 135 minutes in all. 1. [Write a README for a data folder](https://idss-mesa.github.io/trainings/tutorials/write-a-readme/) (10 minutes) 2. [Add metadata to a file or folder](https://idss-mesa.github.io/trainings/tutorials/add-metadata/) (5 minutes) 3. [Record the software versions a result depends on](https://idss-mesa.github.io/trainings/tutorials/record-software-versions/) (5 minutes) 4. [Leave a notebook someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/leave-a-rerunnable-notebook/) (5 to 10 minutes) 5. [Say where your input data came from](https://idss-mesa.github.io/trainings/tutorials/say-where-data-came-from/) (5 to 10 minutes) 6. [State what AI did in your analysis](https://idss-mesa.github.io/trainings/tutorials/state-what-ai-did/) (5 to 10 minutes) 7. [Hand your folder to a colleague and have them rerun it](https://idss-mesa.github.io/trainings/tutorials/hand-over-and-rerun/) (10 minutes) ### More on metadata 1. [Describe a folder with DataCite fields](https://idss-mesa.github.io/trainings/tutorials/describe-with-datacite-fields/) (5 to 10 minutes) 2. [Add Dublin Core fields to a folder](https://idss-mesa.github.io/trainings/tutorials/describe-with-dublin-core-fields/) (5 minutes) 3. [Record where and when data was collected, with EML fields](https://idss-mesa.github.io/trainings/tutorials/describe-with-eml-fields/) (5 to 10 minutes) 4. [Make a folder's metadata valid Croissant](https://idss-mesa.github.io/trainings/tutorials/make-metadata-valid-croissant/) (5 to 10 minutes) 5. [Tag a folder with an ontology term](https://idss-mesa.github.io/trainings/tutorials/tag-with-an-ontology-term/) (5 minutes) ### Preserve and share, in R 1. [Leave an R script someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/r-leave-a-rerunnable-script/) (5 to 10 minutes) 2. [Write a README for a data folder, from RStudio](https://idss-mesa.github.io/trainings/tutorials/r-write-a-readme/) (10 minutes) 3. [Record the R and package versions a result depends on](https://idss-mesa.github.io/trainings/tutorials/r-record-software-versions/) (5 minutes) 4. [Hand your folder to a colleague and have them rerun it, in R](https://idss-mesa.github.io/trainings/tutorials/r-hand-over-and-rerun/) (10 minutes) ## Looking for one thing? Every tutorial is listed, with a one-line description, under [Tutorials](https://idss-mesa.github.io/trainings/tutorials/). ---8<--- https://idss-mesa.github.io/trainings/pathways/self-checks/ --- type: Reference title: "Self-checks" description: "Short questions for checking yourself after a tutorial, each with its answer, the likely slips, and how the answer is confirmed against the practice data." tags: [pathway, self-check, practice-data] status: draft generated: { by: "gen-pathways/1", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-11T00:00:00Z" sources: - id: pathways resource: "https://github.com/idss-mesa/trainings/blob/main/data/pathways.yml" title: "MESA Trainings pathway data" author: "team:idss-mesa" --- # Self-checks A self-check is one short question to try after a tutorial. Its answer comes from doing the task: most ask for a number the tutorial does not print, which you get with a small change to what it taught. They are for your own use. Nothing records or sends your answers unless you use the check on the tutorial's own page, and then only [in your own browser](https://idss-mesa.github.io/trainings/progress/). Each answer is folded away. Try the question first. ## 1. Orient and navigate Already at home here? If you can answer the 3 questions marked *skip-check*, you can skip this point. If one goes wrong, its tutorial covers it. ??? question "The path you copied stops at /iplant/home/shared, and the listing holds many projects that are not MESA's. Which did you click?" After [Find MESA's community data in the Data Browser](https://idss-mesa.github.io/trainings/tutorials/find-community-data/) · *skip-check*. The path you copied stops at `/iplant/home/shared`, and the listing holds many projects that are not MESA's. Which did you click? - Community - Shared - User Shared ??? success "Answer" **Shared.** Shared opens every CyVerse community project. Community is the MESA folder inside it. If you answered *Community*: Community opens the MESA folder, and its path goes on to `/iplant/home/shared/mesa`. Not machine-checked: this is about a portal screen, which only a person can confirm. ??? question "Which of these tells you that a file will still be there after the app stops?" After [Save your work where it survives the session](https://idss-mesa.github.io/trainings/tutorials/save-your-work/) · *skip-check*. - It is listed in JupyterLab's file browser - The dot on the notebook's tab has gone - It is listed under My Files in the portal ??? success "Answer" **It is listed under My Files in the portal.** The Data Browser reads the Data Store directly, not the running app. If you answered *It is listed in JupyterLab's file browser*: JupyterLab also lists files on the app's own disk, which is removed when the app ends. If you answered *The dot on the notebook's tab has gone*: That means the notebook is saved, but not where. It may be on the app's own disk. Not machine-checked: this is about a portal screen, which only a person can confirm. ??? question "Your analysis is listed under Canceled, not Completed. Which button ended it?" After [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/) · *skip-check*. - Relaunch - Save & Exit - Terminate ??? success "Answer" **Terminate.** Terminate ends the app at once without saving its outputs. If you answered *Save & Exit*: Save & Exit stops the app cleanly, and the analysis is then listed under Completed. If you answered *Relaunch*: Relaunch starts the app again with the same settings. It does not end one. Not machine-checked: this is about a portal screen, which only a person can confirm. ## 2. Run and understand Already at home here? If you can answer the 3 questions marked *skip-check*, you can skip this point. If one goes wrong, its tutorial covers it. ??? question "Show the last row of readings. Which gauge and day is it?" After [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/). Show the last row of `readings`. Which gauge and day is it? - G01, 2026-07-01 - G03, 2026-07-31 - G05, 2026-07-09 - G05, 2026-07-31 ??? success "Answer" **G05, 2026-07-31.** The file runs gauge by gauge, so it ends with G05 on the last day of July. ```python readings.tail(1) ``` If you answered *G01, 2026-07-01*: That is the first row, which `head()` shows. `tail()` shows the end. Confirmed against the practice data each time this site is built. ??? question "The largest reading at G02 is 2.92. What is it in millimetres?" After [Read the data dictionary before the data](https://idss-mesa.github.io/trainings/tutorials/read-the-data-dictionary/). ??? success "Answer" **29.2 mm.** G02 reports in centimetres, and a centimetre is ten millimetres. If you answered *2.92*: That is the value as stored, in centimetres. It has not been converted. If you answered *0.292*: That divides by ten. Centimetres to millimetres multiplies by ten. Confirmed against the practice data each time this site is built. ??? question "How many readings have a value of exactly 0?" After [Check a column's range and missing values](https://idss-mesa.github.io/trainings/tutorials/check-range-and-missing/) · *skip-check*. How many readings have a `value` of exactly 0? ??? success "Answer" **80.** More than half of the 152 readings are dry days. ```python (readings["value"] == 0).sum() ``` If you answered *150*: That is the number of blank flags. The question is about `value`. If you answered *72*: Those are the readings above 0. If you answered *0*: No `value` is blank, but 80 of them are zero. A zero is a measurement, not a gap. Confirmed against the practice data each time this site is built. ??? question "Leave out the flagged readings. What is the largest value that remains?" After [Tally a quality flag before you trust a number](https://idss-mesa.github.io/trainings/tutorials/tally-a-quality-flag/) · *skip-check*. Leave out the flagged readings. What is the largest `value` that remains? ??? success "Answer" **32.5.** Without the suspect reading of 180, the largest is an ordinary wet day at G03. ```python readings.loc[readings["flag"] != "S", "value"].max() ``` If you answered *180*: The flagged reading is still in. Keep only the rows whose flag is not `S`. If you answered *2.92*: That is the largest at G02 alone. Confirmed against the practice data each time this site is built. ??? question "Remove exact repeats with drop_duplicates(). How many rows remain?" After [Count records per day to find incomplete days](https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/) · *skip-check*. Remove exact repeats with `drop_duplicates()`. How many rows remain? ??? success "Answer" **151.** One row, G03 on 5 July, is written twice, so 152 becomes 151. ```python len(readings.drop_duplicates()) ``` If you answered *152*: That is the table as loaded. One row for G03 is written twice. If you answered *155*: That is a complete table, 5 gauges for 31 days. This one has four missing days as well as a repeat. If you answered *1*: That is how many rows are removed, not how many remain. Confirmed against the practice data each time this site is built. ??? question "In local time, on how many days of the week did rain fall at G03?" After [Turn UTC timestamps into local days](https://idss-mesa.github.io/trainings/tutorials/local-days-from-utc/). ??? success "Answer" **5.** Two of the seven local days were dry. If you answered *6*: That counts UTC dates. Evening rain crosses midnight UTC, so it spills into an extra date. If you answered *7*: That counts every day of the week. Two had no rain. If you answered *8*: That is the number of UTC dates the week touches, wet or dry. Confirmed against the practice data each time this site is built. ??? question "In how many of the 168 hours is rain_mm above 0?" After [Work with a long table, one row per kind of measurement](https://idss-mesa.github.io/trainings/tutorials/work-with-a-long-table/). In how many of the 168 hours is `rain_mm` above 0? ??? success "Answer" **17.** Rain fell in about one hour in ten. ```python (wide["rain_mm"] > 0).sum() ``` If you answered *168*: That is every hour. Most of them are dry. If you answered *336*: That is every row of the long table, both measurements together. Confirmed against the practice data each time this site is built. ??? question "What does sum(is.na(readings$flag)) return?" After [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/). What does `sum(is.na(readings$flag))` return? ??? success "Answer" **150.** All but two readings have a blank flag, and `na.strings = ""` reads a blank as missing. If you answered *0*: The file was read without `na.strings = ""`, so blanks are empty text, not missing values. If you answered *2*: Those are the flagged readings. `is.na()` counts the ones with no flag. Confirmed against the practice data each time this site is built. ??? question "Which gauge is furthest north?" After [Map point data with sf in MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). - G01, Boathouse - G02, Orchard - G03, Observatory - G05, Quarry ??? success "Answer" **G03, Observatory.** Observatory has the largest latitude, so it sits at the top of the map. If you answered *G05, Quarry*: Quarry has the smallest latitude. It is furthest south. If you answered *G01, Boathouse*: Boathouse is furthest west. Its longitude is the most negative. Confirmed against the practice data each time this site is built. ## 3. Query and connect Already at home here? If you can answer the 2 questions marked *skip-check*, you can skip this point. If one goes wrong, its tutorial covers it. ??? question "After the join, how many rows have a unit of cm?" After [Reconcile row counts before and after a join](https://idss-mesa.github.io/trainings/tutorials/reconcile-a-join/) · *skip-check*. After the join, how many rows have a `unit` of `cm`? ??? success "Answer" **31.** Only G02 reports in centimetres, and it has 31 readings. ```python (joined["unit"] == "cm").sum() ``` If you answered *1*: That counts gauges. The join gives every one of G02's readings its unit. If you answered *121*: Those are the rows in millimetres. Confirmed against the practice data each time this site is built. ??? question "With one SQL query on readings.parquet, count the readings above 20." After [Query a Parquet file with DuckDB from a notebook](https://idss-mesa.github.io/trainings/tutorials/query-parquet-with-duckdb/) · *skip-check*. With one SQL query on `readings.parquet`, count the readings above 20. ??? success "Answer" **19.** The count mixes units, as the file does, so G02's centimetre values never pass 20. ```python duckdb.sql("SELECT count(*) FROM 'readings.parquet' WHERE value > 20") ``` If you answered *10*: That is the count above 25. If you answered *152*: That is every row. Add `WHERE value > 20`. Confirmed against the practice data each time this site is built. ## 4. Explore and verify Already at home here? If you can answer the 1 questions marked *skip-check*, you can skip this point. If one goes wrong, its tutorial covers it. ??? question "Convert G02 to millimetres, leave out the flagged readings, and drop the repeated row. Which gauge then has the largest July total?" After [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/) · *skip-check*. - G05, 210.9 mm - G03, 251.1 mm - G03, 273.6 mm - G05, 390.9 mm ??? success "Answer" **G03, 251.1 mm.** Observatory leads once the data is cleaned. G01 is still missing four days, so even this is not yet a fair comparison. If you answered *G05, 390.9 mm*: That total includes the reading of 180 that the sensor flagged as suspect. If you answered *G05, 210.9 mm*: That is G05 without its flagged reading, but G03 is higher. If you answered *G03, 273.6 mm*: The repeated row for 5 July is still counted twice. Confirmed against the practice data each time this site is built. ## Next - [Choose a pathway](https://idss-mesa.github.io/trainings/pathways/) - [Your progress](https://idss-mesa.github.io/trainings/progress/) ---8<--- https://idss-mesa.github.io/trainings/progress/ --- type: Reference title: "Your progress" description: "Where you are on each learning pathway, kept only in your own browser, with ways to save a copy to a file, bring one back, and clear it." tags: [pathway, progress, privacy] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-14T00:00:00Z" } stale_after: "2027-05-14T00:00:00Z" sources: - id: pathways resource: "https://github.com/idss-mesa/trainings/blob/main/data/pathways.yml" title: "MESA Trainings pathway data" author: "team:idss-mesa" - id: webkit-itp resource: "https://webkit.org/blog/10218/full-third-party-cookie-blocking-and-more/" title: "Full Third-Party Cookie Blocking and More (7-day cap on script-writable storage)" author: "team:webkit" --- # Your progress This page shows where you are on each [learning pathway](https://idss-mesa.github.io/trainings/pathways/): what you have finished, what comes next, and how far along each of the five points you are. It is drawn by a script in your browser. If you see only this text, scripts are off or blocked. The pathways and the tutorials work without them; only the record of what you have finished is missing. ## How your progress is kept Your progress is kept in this browser only. Nothing is sent to MESA or to anyone else, and no account is involved. - **"Done" is your own word.** The tutorials happen in the MESA Portal, in another tab, and this site cannot see them. A tutorial is marked done when you say so. - **A browser can clear it.** Safari does so after seven days without a visit[^webkit-itp], and clearing your browsing history does it in any browser. Progress made in one browser or on one device does not appear in another. - **Save a copy if you want to keep it.** With scripts on, this page offers to save your progress to a file, to bring a saved file back, and to clear everything. ## What the record holds For each tutorial you finish: its name, the day you marked it done, and which revision of the tutorial that was, so the site can tell you if the tutorial has changed since. It also holds the pathway you are following and, if you choose one, the level you give yourself at each point. If you answer "Where are you starting?" on the [pathways page](https://idss-mesa.github.io/trainings/pathways/), it holds those answers: whether you have used the portal, Python or R, whether you have checked a dataset before, and how long you have. They shorten your route and can be cleared there at any time. If you use the [self-checks](https://idss-mesa.github.io/trainings/pathways/self-checks/), it holds for each question whether you got it right, how many tries you took, how sure you said you were, and the day. If you write a reflection at the end of a point, it holds your words. You can save your reflections, levels, and finished tutorials as a Markdown file to bring with you. It holds nothing about who you are. [^webkit-itp]: https://idss-mesa.github.io/trainings/WebKit, "Full Third-Party Cookie Blocking and More", . ---8<--- https://idss-mesa.github.io/trainings/tutorials/sign-in/ --- type: Guide title: "Sign in to the MESA Portal with a CyVerse account" description: "Sign in to the MESA Portal at mesa.cyverse.org with a free CyVerse account and confirm that you reached your dashboard." tags: [byte, p1, portal, sign-in, cyverse] status: draft generated: { by: "claude-code/2.1.224", at: "2026-11-11T00:00:00Z" } stale_after: "2027-05-11T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/overview/" title: "MESA Portal overview" author: "team:idss-mesa" --- # Sign in to the MESA Portal with a CyVerse account !!! warning "Draft: not yet validated" This tutorial was written from the MESA documentation. Nobody has yet followed it from start to finish on the live portal, so a screen name or a step may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** be signed in to the MESA Portal, looking at your own dashboard. **Time:** 5 minutes. **You need:** a web browser and a CyVerse account. If you do not have one, register free at before you start. ## Steps 1. Open . You should see: the portal's landing page, with a **Sign in with CyVerse** button and a **Create Account** button. ![The MESA Portal landing page, with Sign in with CyVerse and Create Account buttons](https://idss-mesa.github.io/docs/assets/portal/portal-landing.webp) 2. Click **Sign in with CyVerse**. **Login** in the top bar does the same thing. You should see: the CyVerse sign-in page, which asks for a username and a password. 3. Enter your own CyVerse username and password and submit the form. Type them only on the CyVerse sign-in page, never into a notebook, a file, or a chat. You should see: the portal again, now on **Home**, your dashboard. 4. Look at the sidebar on the left. You should see: under **Data & Apps**, the pages **Data Browser**, **Applications**, and **Analyses**. ## Check it worked **Home** shows four panels: **Recent Analyses**, **Resource Usage**, **My Working Groups**, and **Quick Actions**. A visitor who is not signed in never sees these. ## If it didn't **The sidebar lists only Home and Data Browser.** You are still signed out. The portal lets visitors look at public data without an account, so it can seem to work. Click **Login** in the top bar and repeat steps 2 and 3. ## Next - [Find your way around the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/find-your-way-around/) - [Find MESA's community data in the Data Browser](https://idss-mesa.github.io/trainings/tutorials/find-community-data/) - [Launch MESA JupyterLab with your Data Store mounted](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/) - Reference: [MESA Portal overview, "Sign in"](https://idss-mesa.github.io/docs/portal/overview/#sign-in), which also lists what works without signing in. *Not yet validated on the live portal. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-11 from the MESA documentation.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/find-your-way-around/ --- type: Guide title: "Find your way around the MESA Portal" description: "Use the MESA Portal's sidebar, dashboard, and user menu to reach your data, the apps, your analyses, and your quota." tags: [byte, p1, portal, navigation, dashboard] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-12T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/overview/" title: "MESA Portal overview" author: "team:idss-mesa" --- # Find your way around the MESA Portal !!! warning "Draft: not yet validated" These steps were followed on the live portal on 2026-11-13, on a newly created account, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** know where each part of the portal is, and have checked how much of your quota you have used. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/). ## Steps 1. Click **Home** in the sidebar on the left. You should see: your dashboard, with four panels. ![The portal dashboard: Recent Analyses, Resource Usage, My Working Groups, and Quick Actions](https://idss-mesa.github.io/docs/assets/portal/portal-dashboard.webp) 2. Read **Resource Usage**. You should see: CPU hours and Data Store space, each as an amount used against your CyVerse quota. 3. Read down the sidebar. You should see: three groups. **Portal Navigation** holds **Home**, **Events**, and **Working Groups**. **Data & Apps** holds **Data Browser**, **Applications**, and **Analyses**. **Help & Docs** holds **Documentation**. 4. Click **Data Browser**, then **Applications**, then **Analyses**, looking at each page before you move on. You should see: your files; a card for each MESA app; and a list of the apps you have run, which is empty in a new account. 5. Look at the right-hand end of the top bar. You should see: a round theme button, and your name, which opens your user menu. 6. Click the theme button until the page suits you. You should see: the portal change between **Light**, **Dark**, and **System**. System follows your computer's setting. 7. Click your name. You should see: **My Profile**, **Settings**, and **Logout**. ## Check it worked From any page you can reach your files, the apps, and your analyses in one click, and you can say roughly how many CPU hours you have left. ## If it didn't **There is no sidebar.** On a phone, a tablet, or a narrow window the sidebar folds away. Click the **☰** menu button to open it, or widen the browser window. ## Next - [Find MESA's community data in the Data Browser](https://idss-mesa.github.io/trainings/tutorials/find-community-data/) - [Launch MESA JupyterLab with your Data Store mounted](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/) - Reference: [MESA Portal overview, "Find your way around"](https://idss-mesa.github.io/docs/portal/overview/#find-your-way-around) and ["Dashboard"](https://idss-mesa.github.io/docs/portal/overview/#dashboard). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-12 from the MESA documentation and followed once on the live portal on 2026-11-13.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/find-community-data/ --- type: Guide title: "Find MESA's community data in the Data Browser" description: "Open the MESA community folder in the portal's Data Browser, confirm where you are from the folder header, and copy a folder's path." tags: [byte, p1, portal, data-browser, community-data] status: draft generated: { by: "claude-code/2.1.224", at: "2026-11-11T00:00:00Z" } stale_after: "2027-05-11T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Find MESA's community data in the Data Browser !!! warning "Draft: not yet validated" These steps were followed on the live portal on 2026-11-13, on a newly created account, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have the MESA community folder open and the path of one of its folders copied, ready to paste into a notebook or a terminal. **Time:** 5 minutes. **You need:** a web browser. The community folder is open to everyone, so you can do this without an account; to do it signed in, first [sign in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/). ## Steps 1. Open and click **Data Browser** in the sidebar. You should see: a folder listing. Signed in, it is your own home folder. Signed out, it is already the MESA community data. 2. In the row of buttons under the header, click **Community**. You should see: the folders that MESA shares with everyone. ![The MESA Community folder as a signed-out visitor sees it: read only, with Community and Public views](https://idss-mesa.github.io/docs/assets/portal/data-community.webp) 3. Read the dark band at the top of the listing, the folder header. You should see: the folder's name, counts of folders and files with their total size, and under the name the folder's full address in the CyVerse Data Store, its *path*. 4. Click the name of a folder to open it. You should see: that folder's contents, and a longer trail in the header. Click any part of the trail to go back up. 5. Click the small copy button beside the path. Its tooltip is **Copy path**. You should see: nothing change on the page; the path is now on your clipboard. Paste it somewhere to look at it. ## Check it worked The path you pasted starts with: ```text /iplant/home/shared/mesa ``` ## If it didn't **The path stops at `/iplant/home/shared`, and the listing holds many projects that are not MESA's.** You clicked **Shared**, which opens every CyVerse community project. **Community** is the MESA folder inside it. Click **Community** and repeat from step 3. ## Next - [Search for a file or folder by name](https://idss-mesa.github.io/trainings/tutorials/search-the-data-browser/) - [Launch MESA JupyterLab with your Data Store mounted](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/) - Reference: [Managing data, "Choose where to look"](https://idss-mesa.github.io/docs/portal/data/#choose-where-to-look), which explains all five views, and ["Browse and find files"](https://idss-mesa.github.io/docs/portal/data/#browse-and-find-files) for search and the built-in file viewer. *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-11 from the MESA documentation and followed once on the live portal on 2026-11-13.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/request-app-access/ --- type: Guide title: "Ask CyVerse for access to interactive apps" description: "Send the one-time request that lets a new CyVerse account start MESA JupyterLab and the other interactive apps, and know when it has been granted." tags: [byte, p1, portal, account, applications] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/applications/" title: "Starting applications in the MESA Portal" author: "team:idss-mesa" - id: de-source resource: "https://github.com/cyverse-de/sonora/blob/main/public/static/locales/en/vice.json" title: "CyVerse Discovery Environment: wording of the access request" author: "org:cyverse" --- # Ask CyVerse for access to interactive apps !!! warning "Draft: not yet validated" Steps 1 and 2 were seen on the live portal on 2026-11-13, on a newly created account. Steps 3 to 6 were written from the public source code of the CyVerse Discovery Environment: the form was not sent while drafting, so its wording or layout may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have asked CyVerse, once, to let your account start interactive apps, and know how to tell when it has said yes. **Time:** 5 minutes, then a wait of one to two days. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/). Do this at least two days before you need an app. ## Steps 1. In the portal's sidebar, click **Applications**. On the **MESA JupyterLab** card, click **Instant Launch**. You should see: a **Launching Application** window that reads **Launch Failed**, with `ERR_PERMISSION_NEEDED`. If the app starts instead, your account already has access: [stop the app](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/) and skip the rest. 2. Click **Open in Discovery Environment**. If CyVerse asks you to sign in, use the same account. You should see: the app's launch page in the CyVerse Discovery Environment, with a notice that begins *Please submit this one-time form* and a **Request Access** button. 3. Click **Request Access**. You should see: a window titled **Request access to VICE apps**, with one box, **Briefly describe your science use-case**. VICE is CyVerse's name for interactive apps. 4. In the box, say in a sentence or two what you will use the apps for: your institution, your project, and that you work through MESA. You should see: your text in the box. Write nothing private. People at CyVerse read it. 5. Click **Submit**. You should see: the window close and the message *Your request is submitted. You will be notified when there is an update.* 6. Wait. CyVerse says it answers within one to two days, and longer if it needs to know more about your work. Then repeat step 1. You should see: the app start. ## Check it worked Until CyVerse answers, the Discovery Environment shows this when you open an interactive app there: ```text VICE Access Request Pending Review ``` Once access is granted, **Instant Launch** in the portal starts the app. Continue with [Launch MESA JupyterLab with your Data Store mounted](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/). ## If it didn't **The window says to stop a running analysis.** On a new account nothing is running. Ignore that advice and go on to step 2. **Submit does nothing, and the box reads "Must be at least … characters".** Your description is too short. Add a sentence. **You see "Unable to submit your request. Please try again."** Click **Submit** again. If it fails a second time, wait an hour. **Two working days have passed and the app still fails.** Tell CyVerse support and, if you are preparing for a session, the person who runs it. Do not send the form again: it is sent once per account. ## Next - [Launch MESA JupyterLab with your Data Store mounted](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/) - [Check your CPU hours and storage](https://idss-mesa.github.io/trainings/tutorials/check-your-usage/) - Reference: [Starting applications](https://idss-mesa.github.io/docs/portal/applications/). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16; the failed launch was seen on the live portal on 2026-11-13, and the request form was not sent.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/ --- type: Guide title: "Launch MESA JupyterLab with your Data Store mounted" description: "Start the MESA JupyterLab app from the MESA Portal and confirm that your CyVerse Data Store is available inside it." tags: [byte, p1, applications, jupyterlab, data-store] status: draft generated: { by: "claude-code/2.1.224", at: "2026-11-11T00:00:00Z" } stale_after: "2027-05-11T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/applications/" title: "Starting applications in the MESA Portal" author: "team:idss-mesa" - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" --- # Launch MESA JupyterLab with your Data Store mounted !!! warning "Draft: not yet validated" These steps were followed on the live portal on 2026-11-13, on a newly created account, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have JupyterLab running in a browser tab, with your CyVerse Data Store files available inside it. **Time:** 5 to 10 minutes, most of it waiting for the app to start. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/). ## Steps 1. In the portal's sidebar, click **Applications**. You should see: the **MESA Apps** tab, with a card for each MESA app. One of them is **MESA JupyterLab**. ![The MESA Apps tab: MESA JupyterLab, MESA Cloud Shell, MESA RStudio Geospatial, MESA VS Code, and MESA KASM Ubuntu Desktop](https://idss-mesa.github.io/docs/assets/portal/apps-mesa-apps.webp) 2. On the **MESA JupyterLab** card, click **Instant Launch**. You should see: a new browser tab with a launch page that steps through **Submitting**, **Queued**, **Container Starting**, **Initializing**, and **Running**. 3. Wait. Starting usually takes half a minute to three minutes. You should see: the launch page replaced by JupyterLab, with a file browser on the left and a **Launcher** tab in the middle. The first time, a small box at the bottom right asks whether you want Jupyter news; click **No**. 4. In the **Launcher**, click **Terminal**, then run: ```bash pwd ``` You should see: ```text /home/jovyan/data-store ``` The app opens inside `~/data-store`, which is where your Data Store is mounted. 5. In the same terminal, run: ```bash ls ~/data-store ``` You should see: two folders. ```text data home ``` Your own files are inside `home`, in a folder named after your CyVerse username. `home` also holds `shared`, which is data that projects have shared. ## Check it worked The `ls` command in step 5 lists `data` and `home`. An error such as `No such file or directory`, or no output at all, means the Data Store is not mounted. ## If it didn't **No new tab opened, and a Launching Application window appeared on the page.** Your browser blocked the tab, so the portal shows the same progress in that window. Wait for it to read **Application Ready**, then click **Open MESA JupyterLab**. If you closed the window, click **Analyses** in the sidebar and **Open App** on the running analysis. **The window reads Launch Failed, with `ERR_PERMISSION_NEEDED`.** A new CyVerse account must ask once for access to interactive apps. Ignore the advice to stop a running analysis, and follow [Ask CyVerse for access to interactive apps](https://idss-mesa.github.io/trainings/tutorials/request-app-access/). CyVerse says it answers within one to two days. Then launch again. ## Next - [Launch an app with the cores, memory, and time you choose](https://idss-mesa.github.io/trainings/tutorials/launch-with-options/) - [Save your work where it survives the session](https://idss-mesa.github.io/trainings/tutorials/save-your-work/). Do this before you write anything you want to keep. - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/) - Reference: [Starting applications](https://idss-mesa.github.io/docs/portal/applications/) for **Launch with Options** (CPU cores, memory, time limit, GPU), and [MESA JupyterLab](https://idss-mesa.github.io/docs/apps/jupyterlab/) for what the app contains. *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-11 from the MESA documentation and followed once on the live portal on 2026-11-13.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/save-your-work/ --- type: Guide title: "Save your work where it survives the session" description: "Save a notebook inside your Data Store from MESA JupyterLab and confirm from the MESA Portal that it will outlive the app." tags: [byte, p1, jupyterlab, data-store, saving] status: draft generated: { by: "claude-code/2.1.224", at: "2026-11-11T00:00:00Z" } stale_after: "2027-05-11T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps (Your Data Store inside the app)" author: "team:idss-mesa" - id: docs-data resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Save your work where it survives the session !!! warning "Draft: not yet validated" These steps were followed on the live portal on 2026-11-13, on a newly created account, by the AI assistant that drafted them. On that run the notebook was made from the Launcher, not the File menu. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A MESA app runs in a temporary container. When the app ends, everything in it is deleted except what sits under `~/data-store`, which is your CyVerse Data Store. **You will:** have a notebook saved in your Data Store, and have seen it from the portal. **Time:** 5 to 10 minutes. **You need:** [MESA JupyterLab running](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/). ## Steps 1. In JupyterLab, look at the file browser on the left. You should see: the contents of `~/data-store`, the folder the app opens in: two folders, `data` and `home`. 2. In the file browser, double-click **home**, then the folder named after your CyVerse username. That folder is your Data Store home folder. You should see: the same files and folders that **My Files** shows in the portal's Data Browser. In a new account it may be nearly empty. 3. Choose **File → New → Notebook**. In the **Select Kernel** box, change the choice to **Python 3 (ipykernel)** (it starts on another language) and click **Select**. You should see: a new tab named `Untitled.ipynb`. 4. Choose **File → Rename Notebook…**. In the **Rename File** box the part of the name before `.ipynb` is already selected: type `first-notebook` over it and click **Rename**. You should see: the new name on the tab and in the file browser. 5. Type this into the first cell and press ++shift+enter++, then choose **File → Save Notebook**: ```python print("saved in my Data Store") ``` You should see: `saved in my Data Store` printed under the cell. 6. Go back to the portal's browser tab. Click **Data Browser**, then **My Files**. You should see: `first-notebook.ipynb` in the listing. A new file can take a few seconds to appear; refresh the page if it is not there yet. ## Check it worked `first-notebook.ipynb` is listed under **My Files** in the portal. The Data Browser reads the Data Store directly, not the running app, so a file you can see there is kept when the app ends. ## If it didn't **A Rename file box appears when you save.** JupyterLab asks for a name the first time you save a notebook still called `Untitled`. Type the name and click **Rename and Save**. **The notebook is in JupyterLab but never appears in My Files.** It was saved outside your home folder in the Data Store. Find it in JupyterLab's file browser, drag it into your home folder (step 2), and check **My Files** again. The same applies to anything a terminal wrote to `~`, `~/work`, or `/tmp`: move it under `~/data-store` before you stop the app. ## Next - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/) - Reference: [Your Data Store inside the app](https://idss-mesa.github.io/docs/apps/agents/#your-data-store-inside-the-app) and [Managing data, "Data in the apps"](https://idss-mesa.github.io/docs/portal/data/#data-in-the-apps). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-11 from the MESA documentation and followed once on the live portal on 2026-11-13.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/ --- type: Guide title: "Stop an app and find your results" description: "Stop a running MESA app with Save & Exit from the Analyses page and find its results in the Data Browser." tags: [byte, p1, portal, analyses, results] status: draft generated: { by: "claude-code/2.1.224", at: "2026-11-11T00:00:00Z" } stale_after: "2027-05-11T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/analyses/" title: "Managing analyses in the MESA Portal" author: "team:idss-mesa" --- # Stop an app and find your results !!! warning "Draft: not yet validated" These steps were followed on the live portal on 2026-11-13, on a newly created account, by the AI assistant that drafted them. **View Results** was clicked on an earlier run, not this one. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Every app you run is listed in the portal as an *analysis*. A running app counts against your CPU-hour quota until it stops, so stop the ones you have finished with. **You will:** have stopped a running app cleanly and found the work you saved. **Time:** 5 minutes. **You need:** a running app, such as [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with the work you want to keep already [saved in your Data Store](https://idss-mesa.github.io/trainings/tutorials/save-your-work/). ## Steps 1. In the portal's sidebar, click **Analyses**. You should see: your app under **Running**, on a card with a **VICE** badge and the time it has left. ![The Analyses page: quota badges, status cards, and running analyses](https://idss-mesa.github.io/docs/assets/portal/analyses-overview.webp) 2. On that card, click **Save & Exit**, and click **OK** when the browser asks you to confirm. You should see: the card's badge change to **Stopping**, its buttons disappear, and the message *Saving outputs and exiting…*. This takes up to a minute, and you do not need to click again. 3. Wait for the page to update, then click the **Completed Analyses** heading to open that section. You should see: your analysis first in the list, with a **Completed** badge and an **Output** path. 4. On the completed analysis, click **View Results**. You should see: the Data Browser, open on the analysis's output folder. For an interactive app such as JupyterLab this folder is empty, and the portal may say **Unable to Load Files** and offer a password box. Leave the box empty: nothing is wrong, and your work is not kept here. 5. Read the path under the folder's name in the header. You should see: a path under your `analyses` folder, unless you chose another output folder when you launched: ```text /iplant/home//analyses/ ``` 6. Click **My Files** and open the folder where you saved your own work. You should see: the notebooks and files you saved in your home folder under `~/data-store` while the app was running. This is where an interactive app's work lives. ## Check it worked The analysis is listed under **Completed**, and the files you saved are in **My Files**. ## If it didn't **The analysis is under Canceled, not Completed.** You clicked **Terminate**, which ends the app at once without saving its outputs. Work you had saved under `~/data-store` is still in **My Files**; anything else from that session is gone. Click **Relaunch** to start the app again with the same settings. ## Next - [Launch MESA JupyterLab with your Data Store mounted](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), to start again - Reference: [Managing analyses, "Stop an app"](https://idss-mesa.github.io/docs/portal/analyses/#stop-an-app) and ["Find the results"](https://idss-mesa.github.io/docs/portal/analyses/#find-the-results), which also cover **Extend Time**, **Monitor**, and failed analyses. *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-11 from the MESA documentation and followed once on the live portal on 2026-11-13.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/make-a-folder/ --- type: Guide title: "Make a folder in your Data Store" description: "Create a folder in your Data Store from the MESA Portal's Data Browser, so that a piece of work has one place to live." tags: [byte, p1, portal, data-browser, folders] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Make a folder in your Data Store !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-13, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have a new, empty folder of your own in your Data Store. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/). ## Steps 1. In the sidebar, click **Data Browser**, then **My Files**. You should see: your home folder, with **Upload**, **New File**, and **New Folder** buttons above the listing. 2. Click **New Folder**. You should see: a **Create New Folder** window with a **Folder name** box. 3. Type a name. Use lower-case letters, numbers, and hyphens, for example `mesa-practice`. You should see: the name in the box. The window allows spaces, but a name without them is easier to type in a notebook or a terminal later. 4. Click **Create**. You should see: the button read **Creating…**. This can take ten to fifteen seconds; do not click again. 5. Wait for the listing to refresh, then click the new folder's name. You should see: the folder open, with its name in the dark header band, **Owner** as your access, and *No files in this directory*. If you reload the page while you are in an empty folder, the portal shows a password box headed **Unable to Load Files**. Nothing is wrong and you do not need to type a password: the folder is only empty. 6. Read the path under the folder's name. You should see: ```text /iplant/home//mesa-practice ``` ## Check it worked Click **My Files**. The new folder is listed with your other folders. Inside a MESA app it is at `~/data-store/home//mesa-practice`. ## If it didn't **There is no New Folder button.** You are in a folder you cannot write to, such as **Community**, or you are signed out. Click **My Files** and look again; if the sidebar shows only **Home** and **Data Browser**, [sign in](https://idss-mesa.github.io/trainings/tutorials/sign-in/) first. ## Next - [Share a folder with a collaborator](https://idss-mesa.github.io/trainings/tutorials/share-a-folder/) - [Add metadata to a file or folder](https://idss-mesa.github.io/trainings/tutorials/add-metadata/) - Reference: [Managing data, "Upload, create, move, and delete"](https://idss-mesa.github.io/docs/portal/data/#upload-create-move-and-delete). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/rename-a-folder/ --- type: Guide title: "Rename a folder in your Data Store" description: "Give a folder in your Data Store a clearer name from the MESA Portal's Data Browser, and confirm its path changed with it." tags: [byte, p1, portal, data-browser, folders] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Rename a folder in your Data Store !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-13, by the AI assistant that drafted them, on a folder and then on a file. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have a folder with a new name, and know what else the change affects. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and a folder of your own to rename. [Make a folder](https://idss-mesa.github.io/trainings/tutorials/make-a-folder/) called `draft` if you have none to spare. ## Steps 1. In the sidebar, click **Data Browser**, then **My Files**. You should see: a card for each of your folders, each with a **⋮** button at its right-hand end. 2. Click **⋮** on the folder's card. You should see: a menu with **Rename**, **Metadata**, **Full Metadata Page**, **Share**, and **Trash**. ![A card's ⋮ menu: Rename, Metadata, Full Metadata Page, Share, and Trash](https://idss-mesa.github.io/docs/assets/portal/data-card-menu.webp){ width="420" } 3. Click **Rename**. You should see: a **Rename** window with a **New name** box. The present name is in the box and already selected. A file is renamed the same way; for a file, only the part before the ending (such as `.ipynb`) is selected, so the ending stays. 4. Type the new name, for example `rain-2026`. Use lower-case letters, numbers, and hyphens. You should see: your text replace the old name. 5. Click **Rename**. You should see: the notice **Renamed successfully** at the top right, and after a few seconds the card under its new name. 6. Click the folder's new name to open it, and read the path under its name in the header. You should see: the path end in the new name. ## Check it worked The path in the folder header ends with the name you typed: ```text /iplant/home//rain-2026 ``` ## If it didn't **The card still shows the old name.** The listing can lag behind the change. Wait a few seconds and reload the page. **There is no ⋮ button, or no Rename in the menu.** The folder is not yours. Click **My Files** and look there. ## Next - A rename changes the path. Any notebook or script that reads from the old path must be changed to the new one, so rename early, before you write code against a folder. - [Move folders into another folder](https://idss-mesa.github.io/trainings/tutorials/move-folders/) - Reference: [Managing data, "Upload, create, move, and delete"](https://idss-mesa.github.io/docs/portal/data/#upload-create-move-and-delete). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/move-folders/ --- type: Guide title: "Move folders into another folder" description: "Select several folders in the MESA Portal's Data Browser and move them together into another folder in your Data Store." tags: [byte, p1, portal, data-browser, folders] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Move folders into another folder !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-13, by the AI assistant that drafted them, on folders. Moving one file the same way was also tried once and behaved the same. Moving by dragging was not tried. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have two folders moved together into a third. **Time:** 5–10 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and three folders of your own in the same place. [Make them](https://idss-mesa.github.io/trainings/tutorials/make-a-folder/) if you need to: `notes-a`, `notes-b`, and `archive`. ## Steps 1. In the sidebar, click **Data Browser**, then **My Files**. You should see: a card for each folder, each with a small box at its left-hand end. 2. Tick the box on `notes-a`. You should see: a toolbar above the cards that says **1 item selected**, with **Trash**, **Move**, **Share**, and **Clear**. 3. Tick the box on `notes-b`. You should see: **2 items selected**. **Select All**, above the listing, ticks every card on the page, and **Clear** unticks them all. 4. Click **Move** in the toolbar. You should see: a **Move 2 item(s)** window with a **Destination path** box. 5. Make the box hold the full path of the folder to move into. If it already holds the path of the folder you are in, add `/archive` to the end. If it is empty, type the whole path: ```text /iplant/home//archive ``` You should see: the complete path in the box, starting with `/iplant/home/`. 6. Click **Move**. You should see: the notice **Moved 2 item(s)** at the top right. 7. Wait about twenty seconds, reload the page, and click `archive` to open it. You should see: `notes-a` and `notes-b` inside `archive`, and no longer in the folder you started in. ## Check it worked Open one of the moved folders and read the path in its header. It now passes through `archive`: ```text /iplant/home//archive/notes-a ``` ## If it didn't **The folders are still listed where they were.** The notice appears before the listing catches up. Wait, then reload the page; do not move them a second time. **Move failed, "dest must be a non-blank string".** The path in the box was not complete. Type all of it, from `/iplant/home/`. **Move failed, `ERR_CONFLICT`.** CyVerse is still busy with one of the items, for example one just restored from the trash. Wait a minute and click **Move** again. ## Next - A move changes the path, just as a rename does: update any notebook or script that reads from the old one. - [Move a folder to the trash and get it back](https://idss-mesa.github.io/trainings/tutorials/trash-and-restore/) - Reference: [Managing data, "Work on several items at once"](https://idss-mesa.github.io/docs/portal/data/#work-on-several-items-at-once). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/trash-and-restore/ --- type: Guide title: "Move a folder to the trash and get it back" description: "Move a folder to your Data Store trash from the MESA Portal, then restore it from the trash in the CyVerse Discovery Environment." tags: [byte, p1, portal, data-browser, folders, discovery-environment] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Move a folder to the trash and get it back !!! warning "Draft: not yet validated" These steps were followed once on 2026-11-13, by the AI assistant that drafted them, on a folder and then on a file. The browser used for the test could not show the confirmation box in step 3, so it was accepted automatically; its wording is as the portal sends it. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have put a folder in the trash, and brought it back. **Time:** 10 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and a folder of your own that you can afford to lose. [Make one](https://idss-mesa.github.io/trainings/tutorials/make-a-folder/) called `old-notes`. ## Steps 1. In the sidebar, click **Data Browser**, then **My Files**. You should see: a card for each folder, with a **⋮** button at its right-hand end. 2. Click **⋮** on `old-notes`, then **Trash**. You should see: your browser ask *Move "old-notes" to trash?* 3. Click **OK**. You should see: the notice *"old-notes" moved to trash — it will disappear shortly*, and the card turn grey and read **Deleting…**. 4. Wait half a minute and reload the page. You should see: no `old-notes` card. The folder is in the trash, not destroyed. 5. The portal has no view of the trash. Open the Discovery Environment at in a new tab. It uses the same CyVerse account. You should see: the Discovery Environment's **Data** page, with a button near the top left that carries your username. 6. Click that button and choose **Trash**. You should see: one row for the folder, named `old-notes` followed by a dot and a few random characters. 7. Tick the box on that row. Then click the **Trash** button at the top right and choose **Restore**. You should see: the notice *Restoring requested item(s)*. 8. Go back to the MESA Portal tab, wait a minute, and reload **My Files**. You should see: `old-notes` again, under its original name. ## Check it worked `old-notes` is listed in **My Files** with the name and path it had before you trashed it. ## If it didn't **The grey card does not go away.** It stays until the page is reloaded. Reload. **The folder is not back yet.** Restoring is not instant. Wait another minute and reload. For a minute or so after it returns, moving it can fail with `ERR_CONFLICT`; wait and try again. ## Next - In the Discovery Environment's Trash, **Delete** and **Empty Trash** destroy items for good. Use them only when you are sure. - A file goes to the trash and comes back the same way. On the test, a trashed file's card left the listing by itself after a few seconds, and the file was back half a minute after **Restore**. - To trash several items at once, tick their boxes and click **Trash** in the toolbar: see [Move folders into another folder](https://idss-mesa.github.io/trainings/tutorials/move-folders/) for the toolbar. - Reference: [Managing data, "Upload, create, move, and delete"](https://idss-mesa.github.io/docs/portal/data/#upload-create-move-and-delete). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/upload-a-file/ --- type: Guide title: "Upload a file from your computer to your Data Store" description: "Copy a file from your own computer into a folder of your CyVerse Data Store with the Upload button in the MESA Portal Data Browser, and confirm it arrived whole." tags: [byte, p1, portal, data-browser, upload] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Upload a file from your computer to your Data Store !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-16, by the AI assistant that drafted them. In step 3 the file was handed to the page by a script, because the test browser cannot open a file chooser; dragging a file onto the listing was not tried. No person has yet followed them. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have a file from your computer in your Data Store, where MESA apps can read it. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and a folder of your own, such as `mesa-practice` from [Make a folder in your Data Store](https://idss-mesa.github.io/trainings/tutorials/make-a-folder/). Have a small file ready on your computer. [Bring your own data to MESA](https://idss-mesa.github.io/trainings/bring-your-own-data/) says what to leave out. ## Steps 1. In the sidebar, click **Data Browser**, then **My Files**, and open the folder the file should go into. You should see: the folder's name in the dark header band, and **Upload**, **New File**, and **New Folder** above the listing. 2. Click **Upload**. You should see: an **Upload Files** window with a **Choose Files** button. ![The Upload Files dialog with two files selected](https://idss-mesa.github.io/docs/assets/portal/data-upload.webp) 3. Click **Choose Files** and pick the file on your computer. Note its size there. You should see: the file's name and size listed in the window, for example *gauges-copy.csv (135 B)*. 4. Click **Upload**. You should see: the window close, and an **Uploads** panel at the bottom right with the file's name and a progress bar. 5. Wait for the green tick in the **Uploads** panel. You should see: the listing refresh by itself within about ten seconds, with a new card for the file. 6. Read the size on the new card. You should see: the size the file has on your computer. ## Check it worked The file's card is in the folder, and its size matches the original. Inside a MESA app the file is at `~/data-store/home//` followed by the folder and file name. ## If it didn't **There is no Upload button.** You are in a folder you cannot write to, such as **Community**, or you are signed out. Click **My Files** and look again. **The tick is green but there is no card.** Wait a few seconds and reload the page. **The Uploads panel shows an error.** Read its message, then try once more. If it fails again, [tell us](https://github.com/idss-mesa/trainings/issues) what the message says, without any private file name. ## Next - [Download a file from your Data Store to your computer](https://idss-mesa.github.io/trainings/tutorials/download-a-file/) - [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/) - Reference: [Managing data, "Upload, create, move, and delete"](https://idss-mesa.github.io/docs/portal/data/#upload-create-move-and-delete). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16 and followed once on the live portal that day, with the file supplied by a script.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/download-a-file/ --- type: Guide title: "Download a file from your Data Store to your computer" description: "Save a copy of a file from the MESA Portal Data Browser to your own computer with the card's Download button, and confirm the copy is complete." tags: [byte, p1, portal, data-browser, download] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Download a file from your Data Store to your computer !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-16, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have a copy of one Data Store file on your own computer, and know it is whole. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and a file in your Data Store, such as `gauges.csv` from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). ## Steps 1. In the sidebar, click **Data Browser**, then **My Files**, and open the folder that holds the file. You should see: a card for each file, with its name, its size, and a row of small buttons at the right. 2. On the file's card, hold the pointer over the button with the downward arrow. You should see: the label **Download**. 3. Note the size on the card, then click **Download**. You should see: the message *Downloading gauges.csv...* at the top right. The page itself does not change. 4. Look at your browser's downloads list. You should see: the file, under the name it has in the Data Store. Your browser saves it where it saves every download, usually a folder named **Downloads**. 5. Compare the size of the saved file with the size on the card. You should see: the same size. For `gauges.csv`: ```text 135 B ``` ## Check it worked The saved file opens on your computer, and its size matches the card. `gauges.csv` begins with the line `gauge_id,name,unit,elevation_m`. ## If it didn't **A red message reads "Could not download …".** The portal could not fetch the file. Reload the page, check that you are still signed in, and try again. **The message appears but no file arrives.** Your browser may have asked whether this site may download files, or blocked it. Look for a prompt or an icon in the address bar, and allow it. **The file is large and nothing seems to happen.** The portal reads the whole file before your browser saves it, so a large file takes a while with no progress bar. Wait, and do not click again. ## Next - [Upload a file from your computer to your Data Store](https://idss-mesa.github.io/trainings/tutorials/upload-a-file/) - [Look inside a CSV file from the portal](https://idss-mesa.github.io/trainings/tutorials/preview-a-table/), to read a file without downloading it. - Reference: [Managing data](https://idss-mesa.github.io/docs/portal/data/). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/make-a-new-file/ --- type: Guide title: "Start a new file in the Data Browser" description: "Create a new file from a template, such as a Markdown note, in a folder of your Data Store with the New File button in the MESA Portal Data Browser." tags: [byte, p1, portal, data-browser, files] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Start a new file in the Data Browser !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-16, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have a new file in your Data Store, started from a template, ready to open in a MESA app. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and a folder of your own, such as `mesa-practice` from [Make a folder in your Data Store](https://idss-mesa.github.io/trainings/tutorials/make-a-folder/). ## Steps 1. In the sidebar, click **Data Browser**, then **My Files**, and open the folder the file should go into. You should see: **Upload**, **New File**, and **New Folder** above the listing. 2. Click **New File**. You should see: a **Create New File** window with a **Filename** box, a row of endings under **Extension** (`.md`, `.txt`, `.py`, `.json`, `.csv`, `.r`, and **Custom**), and a **Template preview**. 3. Type a name without an ending, for example `notes`. Use lower-case letters, numbers, and hyphens. You should see: the name in the box. 4. Under **Extension**, click the kind of file you want. `.md`, a Markdown note, is already chosen. You should see: the **Template preview** show what the file will start with. For `.md` that is one line: ```text # Untitled ``` 5. Click **Create**. You should see: the button read **Creating…**. This can take ten seconds; do not click again. 6. Wait for the listing to refresh. You should see: a card named `notes.md`, 12.0 B in size. ## Check it worked The folder lists `notes.md`. The portal made the file; it does not edit it. To write in it, open it in a MESA app, where it is at `~/data-store/home//` followed by the folder name and `notes.md`. ## If it didn't **There is no New File button.** You are in a folder you cannot write to, such as **Community**, or you are signed out. Click **My Files** and look again. **The new file does not appear.** Wait a few seconds and reload the page. **You need an ending that is not listed.** Click **Custom** and type the ending, for example `.yaml`. A custom ending starts as an empty file. ## Next - [Write a README for a data folder](https://idss-mesa.github.io/trainings/tutorials/write-a-readme/) - [Launch MESA JupyterLab with your Data Store mounted](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), to open and edit the file. - Reference: [Managing data, "Upload, create, move, and delete"](https://idss-mesa.github.io/docs/portal/data/#upload-create-move-and-delete). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/search-the-data-browser/ --- type: Guide title: "Search for a file or folder by name" description: "Find files and folders by name with the MESA Portal's Data Browser search, narrow the results, and open the folder a result lives in." tags: [byte, p1, portal, data-browser, search] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Search for a file or folder by name !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-13, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Search looks through the folder you are in and every folder below it, so where you stand decides what you find. **You will:** have found a folder in MESA's community data by typing part of its name. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/). ## Steps 1. In the sidebar, click **Data Browser**, then **Community**. You should see: **MESA Community** in the header, and a **Search files and folders…** box above the listing. 2. Click in the search box and type `lakehouse`. You do not need to press ++enter++. You should see: after a few seconds, the header change to **Search results in MESA Community**, and the line *Found 1 result for "lakehouse" in mesa*. The number will grow as data is added. ![The search box holding "lakehouse", the line "Found 1 result", and one folder with its path](https://idss-mesa.github.io/trainings/assets/tutorials/search-results.png){ width="600" } 3. Look at the result. You should see: its name, and under the name the path of the folder that holds it. 4. In the menu at the right of the search box, choose **Folders**. You should see: only folders in the results. **Files** does the opposite, and **All** shows both. 5. Click **Clear search**, beside the result count. You should see: the search box empty, and the ordinary **MESA Community** listing again. 6. Search for `lakehouse` once more, and this time click the folder's name in the results. You should see: that folder open, with its trail in the header. ## Check it worked You reached a folder by typing part of its name, without clicking down through the folders above it. ## If it didn't **"No results found" for something you know is there.** Two causes are common. You are searching from a folder that does not contain it: click **My Files** or **Community** and search again from the top. Or the item is new: in our test, files created within the previous day were not yet found by search. Browse to those instead. **Searching again finds nothing where it found something before.** After you open a result and go back, search looks inside the folder you opened, and the result line says so: *in lakehouse*, not *in mesa*. Click **Community** to search from the top again. ## Next - [Find MESA's community data in the Data Browser](https://idss-mesa.github.io/trainings/tutorials/find-community-data/) - Reference: [Managing data, "Search"](https://idss-mesa.github.io/docs/portal/data/#search). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/browse-a-large-folder/ --- type: Guide title: "Browse a large folder as a sorted list" description: "Switch the MESA Portal's Data Browser to a list, page through a folder with many items, and sort what is on the page." tags: [byte, p1, portal, data-browser] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Browse a large folder as a sorted list !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-13, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have paged through a folder of more than a hundred items, and know what the sort menu does and does not do. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/). ## Steps 1. In the sidebar, click **Data Browser**, then **Shared**. You should see: **Shared Data** in the header, and many folders. This is data that projects across CyVerse have shared, not only MESA's. Below the last card is a line such as *Showing 1–25 of 105 items*. 2. At the right, above the listing, click the second of the two small square buttons. Its tooltip is **List View**. You should see: one folder to a row. The first button, **Grid View**, puts the cards back. 3. Scroll to the bottom and set **Per page** to **50**. You should see: fifty rows, and *Showing 1–50*. 4. Click **Next**. You should see: *Showing 51–100*, and different folders. **Previous** takes you back. 5. Open the sort menu, which reads **Name A–Z**, and choose **Name Z–A**. You should see: the rows on this page in reverse order. Only this page is sorted: the folder that comes last in the whole listing is still on the last page. 6. Choose **Newest first**. You should see: the same rows again, the most recently changed at the top. ## Check it worked You can say how many items the folder holds, from the *Showing … of …* line, and you have seen more than the first 25. ## If it didn't **There is no Next button.** The folder has fewer items than one page holds. Try **User Shared**, which has more. **The item you expected first is not first.** Sorting applies to one page at a time. Set **Per page** to **100** to sort more items together, or [search by name](https://idss-mesa.github.io/trainings/tutorials/search-the-data-browser/) instead. ## Next - [Search for a file or folder by name](https://idss-mesa.github.io/trainings/tutorials/search-the-data-browser/), which is faster than paging when you know part of the name. - Reference: [Managing data, "Browse and find files"](https://idss-mesa.github.io/docs/portal/data/#browse-and-find-files). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/view-a-notebook/ --- type: Guide title: "Read a notebook in the portal without starting an app" description: "Open a saved Jupyter notebook in the MESA Portal's Notebook Viewer to read its code and saved output, without launching JupyterLab." tags: [byte, p1, portal, data-browser, notebook] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Read a notebook in the portal without starting an app !!! warning "Draft: not yet validated" The viewer was opened once on the live portal on 2026-11-13, by the AI assistant that drafted these steps. The browser used for the test blocks new tabs, so the viewer was opened at its address, not with the **View** button. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Starting JupyterLab takes a minute and uses CPU hours. To read a notebook, you do not need it: the portal shows the code and the output that was saved with it. **You will:** have read a saved notebook, with its output, in the portal. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and a notebook in your Data Store, such as `first-notebook.ipynb` from [Save your work](https://idss-mesa.github.io/trainings/tutorials/save-your-work/). ## Steps 1. In the sidebar, click **Data Browser**, then **My Files**. Open the folder that holds the notebook, if it is in one. You should see: a card for the notebook, with `.ipynb` under its name and a green **View** button. 2. Click **View**. You should see: a new browser tab named `first-notebook.ipynb - Notebook Viewer`. Under the notebook's name it says **Jupyter Notebook** and how many cells there are. 3. Read down the page. You should see: each cell's code beside a label such as `In [1]:`, and under it the output that cell gave when the notebook was last saved. For `first-notebook.ipynb`: ```text saved in my Data Store ``` 4. Close the tab. You should see: the Data Browser tab, as you left it. ## Check it worked You read the notebook's output, and the **Analyses** page shows no new running app. The viewer only displays the file. It runs nothing and changes nothing. ## If it didn't **No tab opened.** Your browser blocked the pop-up. Allow pop-ups for `mesa.cyverse.org` and click **View** again. **A cell has no output under it.** The notebook was saved before that cell was run. The viewer shows what is in the file; it cannot run a cell. Open the notebook in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), run it, and save. **A card has no View button.** The portal has no viewer for that kind of file. A Python script (`.py`) is one example. ## Next - Images open the same way. **View** on a `.png` opens the Image Viewer, which shows the picture with its size in pixels and zoom buttons. - [Look inside a CSV file from the portal](https://idss-mesa.github.io/trainings/tutorials/preview-a-table/) - Reference: [Managing data, "View files in the browser"](https://idss-mesa.github.io/docs/portal/data/#view-files-in-the-browser). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/preview-a-table/ --- type: Guide title: "Look inside a CSV file from the portal" description: "Open a CSV file in the MESA Portal's Data Viewer and read its columns, row count, and value ranges, then run one SQL query, without launching an app." tags: [byte, p1, portal, data-browser, csv, duckdb] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" - id: duckdb-summarize resource: "https://duckdb.org/docs/stable/guides/meta/summarize" title: "DuckDB: SUMMARIZE" author: "team:duckdb" --- # Look inside a CSV file from the portal !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-13, by the AI assistant that drafted them. The browser used for the test blocks new tabs, so the viewer was opened at its address, not with the **View** button. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** know a table's columns, how many rows it has, and the range of each column, before you launch anything. **Time:** 5–10 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and `readings.csv` in a `mesa-practice` folder in your Data Store. [Download it with MESA Cloud Shell](https://idss-mesa.github.io/trainings/tutorials/cloud-shell-download/) if you have not. ## Steps 1. In the sidebar, click **Data Browser**, then **My Files**, then `mesa-practice`. On the `readings.csv` card, click **View**. You should see: a new tab named `readings.csv - Data Viewer`, with an **SQL Query** box and, under it, the first rows of the table. 2. Click **Schema**. You should see: one row for each column, with its type. ```text gauge_id VARCHAR date DATE value DOUBLE flag VARCHAR ``` 3. Click **Count**. You should see: `total_rows` and, under it, `152`. 4. Click **Stats**. You should see: one row for each column again, now with its smallest and largest value. `date` runs from `2026-07-01` to `2026-07-31`, and `value` from `0.0` to `180.0`. 5. Each button wrote a query into the **SQL Query** box. Replace it with this one, then click **Run**: ```sql SELECT flag, count(*) AS n FROM read_csv('source.csv', auto_detect=true) GROUP BY flag; ``` You should see: two rows. ```text flag n NULL 150 S 2 ``` ## Check it worked The two counts in step 5 add up to the row count in step 3: 150 + 2 = 152. Two readings carry the flag `S`, and the rest have none. ## If it didn't **The dates are long numbers.** **Preview**, and the table the viewer opens with, show a date as a number such as `1782864000000`. **Stats** shows the same column as dates. The file is not damaged. **Run gives an error.** Check the quotes and the spelling. `'source.csv'` is the viewer's name for the CSV file you opened, whatever the file is called. Clicking **Preview** puts a working query back. **There is no View button.** The Data Viewer opens CSV, TSV, Parquet, and DuckDB files. For other tables, [load the file into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/). ## Next - A largest value of 180 is worth a second look: [Check a column's range and missing values](https://idss-mesa.github.io/trainings/tutorials/check-range-and-missing/). - [Tally a quality flag before you trust a number](https://idss-mesa.github.io/trainings/tutorials/tally-a-quality-flag/) does step 5 in a notebook, where you can keep the result. - Reference: [Managing data, "View files in the browser"](https://idss-mesa.github.io/docs/portal/data/#view-files-in-the-browser). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/launch-with-options/ --- type: Guide title: "Launch an app with the cores, memory, and time you choose" description: "Start MESA JupyterLab from the MESA Portal with a name, a number of CPU cores, an amount of memory, and a time limit that you set yourself." tags: [byte, p1, applications, resources, jupyterlab] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/applications/" title: "Starting applications in the MESA Portal" author: "team:idss-mesa" --- # Launch an app with the cores, memory, and time you choose !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-13, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **Instant Launch** starts an app with default settings. **Launch with Options** lets you give it more memory for a large dataset, less time for a short task, and a name you will recognise later. **You will:** have MESA JupyterLab running with the resources and the name you chose. **Time:** 5 to 10 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/). ## Steps 1. In the sidebar, click **Applications**. On the **MESA JupyterLab** card, click **Launch with Options**. You should see: a **Launch MESA JupyterLab** window with **Analysis Settings** and **Resource Configuration**. ![The Launch MESA JupyterLab dialog with CPU selected](https://idss-mesa.github.io/docs/assets/portal/apps-launch-options.webp){ width="460" } 2. Replace the **Analysis Name** with one that says what the session is for, such as `practice-session`. You should see: your name in the box, in place of the app's name and the date. 3. Choose **CPU Cores**. The menu offers 1, 2, or 4. You should see: your choice. For reading and checking small files, 1 is enough. 4. Choose **Memory (RAM)**: 2, 4, 8, or 16 GB. You should see: your choice. As a rule of thumb, allow several times the size of the largest file you will load. 5. Choose a **Time Limit**, from 1 hour to 48 hours. You should see: your choice. The app stops when the limit is reached, whether or not you have finished, so allow some margin. 6. Click **Launch**. You should see: the same launch progress as for [Instant Launch](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), ending with JupyterLab. 7. In the portal, click **Analyses**. You should see: a card under **Running Analyses** with the name you gave. ## Check it worked On the running card, **Time Remaining** is just under the limit you chose: about `59m` for a one-hour limit. ## If it didn't **The launch fails, or the analysis never leaves Pending.** The resources you asked for are not available, or your CPU-hour quota is used up. Check **Resource Usage** on **Home**, then launch again with fewer cores or less memory. ## Next - [Check on a running app and give it more time](https://idss-mesa.github.io/trainings/tutorials/monitor-and-extend/) - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/). A running app uses your CPU hours until it stops. - Reference: [Starting applications, "Launch with Options"](https://idss-mesa.github.io/docs/portal/applications/#launch-with-options), which also covers GPU builds. *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/monitor-and-extend/ --- type: Guide title: "Check on a running app and give it more time" description: "Read how long a running MESA app has left, look at its logs, and extend its time limit from the Analyses page before it stops." tags: [byte, p1, portal, analyses, time-limit] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/analyses/" title: "Managing analyses in the MESA Portal" author: "team:idss-mesa" --- # Check on a running app and give it more time !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-13, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Every interactive app has a time limit. When it runs out the app stops, and anything not saved under `~/data-store` is lost. **You will:** know how long your app has left, and have given it more time. **Time:** 5 minutes. **You need:** a running app, such as [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/). ## Steps 1. In the portal's sidebar, click **Analyses**. You should see: your app under **Running Analyses**, on a card with a **Running** badge. ![A running JupyterLab analysis with the Monitor panel open on the Logs tab](https://idss-mesa.github.io/docs/assets/portal/analyses-monitor.webp) 2. Read **Time Remaining** on the card. You should see: hours and minutes. With an hour or less left, the **Extend Time** button also shows **LOW**. 3. Click **Monitor**. You should see: a panel open under the card, on its **Logs** tab, with the app's own messages. For JupyterLab they include a line for each notebook you opened. 4. Type a word such as `error` in the **Filter logs…** box. You should see: only the lines that contain the word, with the word highlighted; for a healthy app, none. This is the first place to look when an app misbehaves. 5. On the same card, click **Extend Time**, and click **OK** when the browser asks you to confirm. You should see: the button read **Extending…** for a moment. 6. Read **Time Remaining** again. You should see: a longer time, and no **LOW** badge. In our test an app with 59 minutes left had about 25 hours afterwards. ## Check it worked **Time Remaining** is longer than it was in step 2. ## If it didn't **There is no Extend Time button.** It is offered only for running interactive apps, and not while an app is still starting. Wait for the badge to read **Running**, click **Refresh**, and look again. ## Next - An extended app keeps using your CPU hours. When you have finished, [stop it](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/). - The panel's **Resources** tab does not yet show live CPU or memory use. - Reference: [Managing analyses, "Work with a running app"](https://idss-mesa.github.io/docs/portal/analyses/#work-with-a-running-app). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/check-your-usage/ --- type: Guide title: "Check your CPU hours and storage" description: "Find how many CPU hours and how much Data Store space your CyVerse plan allows, and how much you have used, in the MESA Portal." tags: [byte, p1, portal, account, quotas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/overview/" title: "The MESA Portal overview" author: "team:idss-mesa" --- # Check your CPU hours and storage !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-13, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** know your plan's limits for computing time and storage, and how much of each is left. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/). ## Steps 1. In the sidebar, click **Home**. You should see: your dashboard, with a **Resource Usage** panel that carries the name of your plan, for example **BASIC**. 2. Read the **CPU Hours** line. You should see: hours used and hours allowed, for example *0.0 hours / 200.0 hours*, and the share used as a percentage. A running app uses CPU hours for as long as it runs. 3. Read the **Data Storage** line. You should see: space used and space allowed, for example *0.00 B / 5.00 GB*. This is the space your files take in the Data Store. 4. In the sidebar, click **Analyses**. You should see: the same two figures in the page header, as *hours left* and as storage used. 5. Hold the pointer over each figure. You should see: a tooltip with the share used, such as *CPU hours remaining (0.0% used)*. ## Check it worked You can state your plan's two limits and what is left of each. Your limits depend on your plan, and may be larger once CyVerse has given you access to interactive apps. On a new Basic plan they read: ```text 200.0 hours left 0.00 B / 5.00 GB ``` ## If it didn't **Your profile page says "Resource usage data is not available".** That panel, under your name at the top right, was empty on the day this was written. Use **Home** or **Analyses** instead. **The figures have not moved after you ran an app.** They may not be updated the moment an app stops. Look again later. ## Next - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/): an app left running keeps using CPU hours. - [Launch an app with the cores, memory, and time you choose](https://idss-mesa.github.io/trainings/tutorials/launch-with-options/) - Reference: [The MESA Portal overview](https://idss-mesa.github.io/docs/portal/overview/). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/cloud-shell-download/ --- type: Guide title: "Download a file from the web into your Data Store with MESA Cloud Shell" description: "Start MESA Cloud Shell, go to a folder in your Data Store, and fetch a file from a web address straight into it with curl." tags: [byte, p1, cloud-shell, terminal, data-store] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/apps/cli/" title: "MESA CLI (Cloud Shell)" author: "team:idss-mesa" --- # Download a file from the web into your Data Store with MESA Cloud Shell !!! warning "Draft: not yet validated" These steps were followed once in the app on 2026-11-13, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). MESA Cloud Shell is a terminal in your browser. It is the quickest app to start, and a file it downloads goes straight into your Data Store without passing through your own computer. **You will:** have a file from a web address saved in your Data Store. **Time:** 5 to 10 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/). ## Steps 1. In the portal, click **Applications**, and on the **MESA Cloud Shell** card click **Instant Launch**. Wait for the app to open; it can take a minute or two. You should see: a terminal with a MESA welcome screen and a prompt that ends in `~/data-store $>`. 2. Go to your home folder in the Data Store: ```bash cd ~/data-store/home/$IPLANT_USER pwd ``` You should see: the path, ending in your CyVerse username. ```text /home/jovyan/data-store/home/ ``` 3. Make a folder for the file and go into it: ```bash mkdir -p mesa-practice cd mesa-practice ``` You should see: the prompt now ends in `mesa-practice $>`. 4. Fetch the file. `-O` keeps the file's own name: ```bash curl -O https://idss-mesa.github.io/trainings/assets/practice/readings.csv ``` You should see: a progress table whose first number reaches `100`. 5. Check what arrived: ```bash wc -l readings.csv head -3 readings.csv ``` You should see: the line count, then the first three lines. ```text 153 readings.csv gauge_id,date,value,flag G01,2026-07-01,0.0, G01,2026-07-02,0.0, ``` 6. In the portal's browser tab, click **Data Browser**, then **My Files**, and open **mesa-practice**. You should see: `readings.csv` in the listing. ## Check it worked `readings.csv` is in **My Files → mesa-practice** in the portal, and `wc -l` counted 153 lines: a header and 152 readings. ## If it didn't **`head` shows HTML such as `` instead of data.** The address was wrong, and `curl` saved the website's error page under the file's name. Delete it with `rm readings.csv`, check the address, and run step 4 again. Adding `-f` to `curl` makes it refuse to save an error page. ## Next - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/), when you have finished with the terminal. - [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/) - Reference: [MESA CLI (Cloud Shell)](https://idss-mesa.github.io/docs/apps/cli/), for what else the terminal contains. *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once in the app that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/cloud-shell-keep-running/ --- type: Guide title: "Keep a command running in MESA Cloud Shell after you close the tab" description: "Start a slow command in MESA Cloud Shell, open a second terminal window beside it, close the browser tab, and come back from the Analyses page to find the command still running." tags: [byte, p1, cloud-shell, terminal, tmux] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/apps/cli/" title: "MESA CLI (Cloud Shell)" author: "team:idss-mesa" - id: tmux resource: "https://github.com/tmux/tmux/wiki/Getting-Started" title: "Getting Started (tmux wiki)" author: "team:tmux" --- # Keep a command running in MESA Cloud Shell after you close the tab !!! warning "Draft: not yet validated" These steps were followed once in the app on 2026-11-17, by the AI assistant that drafted them, with a longer loop and by leaving the page, not closing the tab. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A download or a conversion can take longer than you want to watch. The Cloud Shell terminal runs inside a program called `tmux`, which keeps your session going on the server whether or not a browser tab is showing it. **You will:** have left a running command, closed the tab, and come back to find it further along. **Time:** 10 minutes. **You need:** MESA Cloud Shell running, as in [Download a file from the web into your Data Store with MESA Cloud Shell](https://idss-mesa.github.io/trainings/tutorials/cloud-shell-download/). ## Steps 1. Click in the terminal and start a command that takes five minutes. This one counts to 60, one step every five seconds: ```bash for i in $(seq 1 60); do echo "step $i"; sleep 5; done ``` You should see: `step 1`, then a new line every five seconds. 2. Press ++ctrl+b++, let go, then press ++c++. You should see: an empty terminal with a new prompt, which begins `(geospatial)`. The counter is out of sight, in the first window. This is a second window of the same session. 3. List the windows: ```bash tmux list-windows ``` You should see: two lines, numbered `0` and `1`, with `(active)` at the end of the one you are in. ```text 0: bash- (1 panes) [160x63] [layout bbfd,160x63,0,0,0] @0 1: bash* (1 panes) [160x63] [layout bbfe,160x63,0,0,1] @1 (active) ``` The numbers in square brackets depend on the size of your browser window. 4. Close the browser tab that holds the terminal. Wait a minute. You should see: the portal's tab, if you still have it open. Nothing in the app has been stopped. 5. In the portal, click **Analyses**, and on the **MESA Cloud Shell** card click **Open App**. You should see: the terminal again, on the window you left: the `tmux list-windows` lines are still there. 6. Press ++ctrl+b++, let go, then press ++0++. You should see: the counter, a dozen or more steps further on than when you left it. It ran while no tab was open. 7. Press ++ctrl+b++, then ++1++, to go back to the second window. Type `exit` and press ++enter++. You should see: the first window again. The second one is closed; the counter stops by itself at `step 60`. ## Check it worked The counter in window `0` shows a higher step after step 6 than it did before you closed the tab, with no step missing in between. ## If it didn't **A `c` or a `0` appears at the prompt and nothing else happens.** `tmux` did not take the two keys as one command. Delete the character, press ++ctrl+b++, release both keys, then press the second key by itself. **There is no MESA Cloud Shell card with Open App.** The app has stopped: it reached its time limit, or someone stopped it. A stopped app takes its session with it. Start the app again, and see [Check on a running app and give it more time](https://idss-mesa.github.io/trainings/tutorials/monitor-and-extend/). ## Next - `tmux` keeps a command running only while the app runs. For work that takes hours, [launch the app with a longer time limit](https://idss-mesa.github.io/trainings/tutorials/launch-with-options/). - Anything the command writes should go under `~/data-store`. The rest of the app is deleted when it stops. - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/) - Reference: [MESA CLI (Cloud Shell), "First steps"](https://idss-mesa.github.io/docs/apps/cli/#first-steps), for splitting a window in two. *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17 and followed once in the app that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/vscode-run-a-script/ --- type: Guide title: "Write and run a Python script in MESA VS Code" description: "Open MESA VS Code on your Data Store, create a Python script in a folder there, and run it in the built-in terminal." tags: [byte, p1, vscode, python, data-store] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/apps/vscode/" title: "MESA VS Code" author: "team:idss-mesa" --- # Write and run a Python script in MESA VS Code !!! warning "Draft: not yet validated" These steps were followed once in the app on 2026-11-13, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). MESA VS Code is the Visual Studio Code editor in a browser tab, opened on your Data Store. A script you write there is saved in your Data Store as you type. **You will:** have a Python script in your Data Store that reads a data file and prints a result. **Time:** 10 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and `readings.csv` in a `mesa-practice` folder in your Data Store, from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/) or from [the Cloud Shell tutorial](https://idss-mesa.github.io/trainings/tutorials/cloud-shell-download/). ## Steps 1. In the portal, click **Applications**, and on the **MESA VS Code** card click **Instant Launch**. Wait for the editor to open. You should see: VS Code, with an **Explorer** panel on the left that lists the folders of your Data Store home under your username. 2. In the **Explorer**, click **mesa-practice**. You should see: the folder open, with `readings.csv` inside it. 3. Right-click **mesa-practice** and choose **New File…**. Type `count_rows.py` and press ++enter++. You should see: the new file in the folder, and an empty editor tab named `count_rows.py`. 4. Type this into the editor: ```python import csv rows = list(csv.DictReader(open("readings.csv"))) flagged = [r for r in rows if r["flag"] == "S"] print(len(rows), "readings,", len(flagged), "flagged") ``` You should see: the code coloured as Python. VS Code saves it for you: **Auto Save** is switched on. 5. Right-click **mesa-practice** again and choose **Open in Integrated Terminal**. You should see: a terminal panel under the editor, with a MESA welcome screen and a prompt that ends in `mesa-practice $>`. 6. Click in the terminal and run the script: ```bash python count_rows.py ``` You should see: ```text 152 readings, 2 flagged ``` ## Check it worked The terminal prints `152 readings, 2 flagged`, and `count_rows.py` is listed in **My Files → mesa-practice** in the portal's Data Browser. ## If it didn't **There is a Chat panel on the right, or notices at the bottom right.** A new account sees these the first time, with **Restricted Mode** in the bottom bar. None of them stops these steps. Close the panel and the notices with their **×**. **The command came out garbled.** You typed before the terminal had finished starting. Wait for the welcome screen and the prompt, press ++ctrl+c++, and type it again. **`FileNotFoundError: [Errno 2] No such file or directory: 'readings.csv'`.** The terminal is not in the folder that holds the data. Its prompt shows where it is. Close it, then repeat step 5, making sure you right-click **mesa-practice** and not the folder above it. ## Next - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/), when you have finished with the editor. - Reference: [MESA VS Code](https://idss-mesa.github.io/docs/apps/vscode/), for the extensions and tools the app contains. *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once in the app that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/vscode-find-in-folder/ --- type: Guide title: "Find a value in every file of a folder with MESA VS Code" description: "Search all the files in a folder of your Data Store for a piece of text in MESA VS Code, read how many times each file contains it, and open a file at the matching line." tags: [byte, p1, vscode, search, data-store] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/apps/vscode/" title: "MESA VS Code" author: "team:idss-mesa" - id: vscode-search resource: "https://code.visualstudio.com/docs/editing/codebasics#_search-across-files" title: "Basic editing: Search across files (Visual Studio Code documentation)" author: "team:microsoft" --- # Find a value in every file of a folder with MESA VS Code !!! warning "Draft: not yet validated" These steps were followed once in the app on 2026-11-17, by the AI assistant that drafted them, in a folder that held more files than the two named here. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Before you rename a gauge, drop a column, or change a code, you need to know every file that mentions it. The portal's search looks at file names. VS Code looks inside the files. **You will:** know which files in a folder contain a given piece of text, and how many times. **Time:** 5 minutes. **You need:** MESA VS Code open, as in [Write and run a Python script in MESA VS Code](https://idss-mesa.github.io/trainings/tutorials/vscode-run-a-script/), and the `mesa-practice` folder with `gauges.csv` and `readings.csv` from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). ## Steps 1. In the **Explorer**, right-click **mesa-practice** and choose **Find in Folder…**. You should see: the **Search** panel in place of the Explorer, with `./mesa-practice` already filled in under **files to include**. 2. In the box at the top, type `G02` and press ++enter++. You should see: a line such as *32 results in 2 files*, and under it each file with the lines that match. The count can rise for a few seconds while the search finishes. 3. Read the number at the right of each file name. You should see: `1` beside `gauges.csv` and `31` beside `readings.csv`: one row that describes the gauge, and one reading for each day of July. Other practice files that mention the gauge, such as `readings_august.csv`, are listed with their own counts. 4. Click the small arrow at the left of a long file, such as `readings.csv`. You should see: its lines fold away, so that the other files fit on the screen. 5. Under `gauges.csv`, click the line `G02,Orchard,cm,540`. You should see: `gauges.csv` open in the editor, with `G02` selected on line 3, and *Ln 3, Col 4* in the bar at the bottom. 6. Look, and do not type. The file is open for editing, and VS Code saves what you type as you type it. You should see: the tab's name in italics, which means a preview. It closes by itself when you open another file. ## Check it worked You can say, without opening them one by one, which files in `mesa-practice` mention `G02` and how often: `gauges.csv` once and `readings.csv` 31 times. ## If it didn't **The search finds files outside your folder.** **files to include** is empty, so VS Code searched your whole Data Store home. Type `./mesa-practice` in that box and press ++enter++. **A file you expected is missing.** Search reads text. It skips files that are not text, such as `readings.parquet` and images. **You typed into the file by accident.** Press ++ctrl+z++ (++cmd+z++ on a Mac) until the line reads as it did. ## Next - The three buttons at the right of the search box narrow the search: **Aa** matches capitals exactly, and **ab** matches whole words only, so that `G02` does not also find `G020`. - [Search for files and folders by name](https://idss-mesa.github.io/trainings/tutorials/search-the-data-browser/), in the portal. - Reference: [MESA VS Code](https://idss-mesa.github.io/docs/apps/vscode/). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17 and followed once in the app that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/desktop-open-a-file/ --- type: Guide title: "Open a file from your Data Store in a desktop program" description: "Start the MESA KASM Ubuntu Desktop, find a file in your Data Store with its file manager, and open it in a desktop program." tags: [byte, p1, kasm, desktop, data-store] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/apps/kasm/" title: "MESA KASM Ubuntu Desktop" author: "team:idss-mesa" --- # Open a file from your Data Store in a desktop program !!! warning "Draft: not yet validated" These steps were followed once in the app on 2026-11-13, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Some software only has a graphical interface: desktop GIS, image editors, 3D viewers. The MESA KASM Ubuntu Desktop is a full Linux desktop in a browser tab, with your Data Store attached, for that kind of program. **You will:** have opened an image from your Data Store in GIMP, an image editor, on the MESA desktop. **Time:** 10 minutes, some of it waiting for the desktop to start. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and an image in your Data Store, such as `gauge-map.png` from [Map point data with sf in MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. In the portal, click **Applications**, and on the **MESA KASM Ubuntu Desktop** card click **Instant Launch**. Wait for the desktop; in our tests it took between forty seconds and two and a half minutes. You should see: a desktop with **Trash**, **File System**, and **Home** icons at the top left, and a row of icons at the bottom. 2. Double-click **Home**. You should see: a file manager window with a **data-store** folder among the others. 3. Double-click **data-store**, then **home**, then the folder named after your CyVerse username. You should see: the folders of your Data Store home, the same ones **My Files** shows in the portal. 4. Double-click the folder that holds your image, for example **mesa-practice**. You should see: your files, each with an icon for its type. 5. Right-click the image, point to **Open With**, and choose **GNU Image Manipulation Program**. You should see: after ten to twenty seconds, a GIMP window with the image in the middle and tool panels on both sides. 6. Read the title bar of the GIMP window. You should see: the file's name and its size in pixels, for example `[gauge-map] (imported)-1.0 (… 1800x1200 – GIMP`. ## Check it worked The image is displayed in GIMP, and the title bar shows its name. You opened it where it lives: nothing was downloaded to your own computer. ## If it didn't **A window asks you to accept the Google Chrome terms of service.** You double-clicked the image, and the desktop's default program for images is Chrome. Click **Cancel**, then open the image with the right-click menu as in step 5. ## Next - Save anything you change under **data-store**. The rest of the desktop is deleted when the app stops. - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/), when you have finished with the desktop. - Reference: [MESA KASM Ubuntu Desktop](https://idss-mesa.github.io/docs/apps/kasm/), for what the desktop contains. *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once in the app that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/desktop-open-a-terminal/ --- type: Guide title: "Open a terminal in a Data Store folder on the MESA desktop" description: "On the MESA KASM Ubuntu Desktop, go to a folder of your Data Store in the file manager, open a terminal that starts in that folder, and run a command on a file there." tags: [byte, p1, kasm, desktop, terminal, data-store] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/apps/kasm/" title: "MESA KASM Ubuntu Desktop" author: "team:idss-mesa" --- # Open a terminal in a Data Store folder on the MESA desktop !!! warning "Draft: not yet validated" These steps were followed once in the app on 2026-11-17, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A desktop program and a command often work on the same files: you look at a map in one window and convert or count the data in another. On the MESA desktop the file manager can open a terminal that starts in the folder you are looking at, so you do not have to type the path. **You will:** have a terminal on the MESA desktop, in a folder of your Data Store, that has run a command on a file there. **Time:** 5 to 10 minutes. **You need:** the MESA KASM Ubuntu Desktop running, as in [Open a file from your Data Store in a desktop program](https://idss-mesa.github.io/trainings/tutorials/desktop-open-a-file/), and `readings.csv` in a `mesa-practice` folder, from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). ## Steps 1. Double-click **Home**, then **data-store**, then **home**, then the folder named after your CyVerse username, then **mesa-practice**. You should see: your files, and the folder's path in the bar at the top of the window, ending in `/mesa-practice/`. 2. Right-click an empty part of the window, between the icons or below them. You should see: a short menu that begins **Create Folder…** and contains **Open Terminal Here**. 3. Choose **Open Terminal Here**. You should see: a **Terminal** window with a MESA welcome screen, and a prompt that ends in `mesa-practice $>`. 4. Click in the terminal and list the folder: ```bash ls ``` You should see: the same file names the file manager shows, `readings.csv` among them. 5. Count the lines of a file: ```bash wc -l readings.csv ``` You should see: a header line and 152 readings. ```text 153 readings.csv ``` ## Check it worked The terminal's prompt names `mesa-practice`, and `wc -l` counted 153 lines in `readings.csv` without you typing a path. ## If it didn't **The menu begins "Open With" and has no "Open Terminal Here".** You right-clicked a file, not the empty background. Press ++esc++ and right-click a gap between two icons. **The prompt shows a path that starts `/data-store/iplant/home/`.** That is the same folder as `~/data-store/home/` under its full name. Nothing is wrong. ## Next - Save what you want to keep under **data-store**. The rest of the desktop is deleted when the app stops. - [Download a file from the web into your Data Store with MESA Cloud Shell](https://idss-mesa.github.io/trainings/tutorials/cloud-shell-download/), for more to do in a terminal. - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/) - Reference: [MESA KASM Ubuntu Desktop](https://idss-mesa.github.io/docs/apps/kasm/). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17 and followed once in the app that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/share-a-folder/ --- type: Guide title: "Share a folder with a collaborator" description: "Give one named CyVerse user read access to a folder in your Data Store from the MESA Portal's Data Browser, and confirm the access took effect." tags: [byte, p1, portal, data-browser, sharing] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-12T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Share a folder with a collaborator !!! warning "Draft: not yet validated" These steps were followed on the live portal on 2026-11-13, on a newly created account, by the AI assistant that drafted them. The check from the second account was done too. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have shared one folder, read only, with one person you chose. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/); a folder of your own in **My Files**, such as the `mesa-practice` folder from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/); and your collaborator's CyVerse username, exactly as they sign in with it. ## Steps 1. In the sidebar, click **Data Browser**, then **My Files**, and open the folder you want to share. You should see: the folder's name in the dark header band, with **Owner** as your permission and **Private** beside it. 2. Click **Share** in the folder header. You should see: the share dialog, with **Public Access**, **Share with User**, and **Current Permissions**, which lists only you and says *Not shared with anyone else*. ![The share dialog for a folder: public access options, Share with User, and Current Permissions](https://idss-mesa.github.io/docs/assets/portal/data-share.webp){ width="520" } 3. Leave the boxes for **All CyVerse Users (public)** and **Anyone without login (anonymous)** unticked. You should see: no change. Those two options open the folder to everyone, which is not what this tutorial is for. 4. Under **Share with User**, type your collaborator's complete CyVerse username. You should see: under the box, a line marked **Match** that shows the email address of that account. The portal needs the whole username or email address; part of one is not enough. 5. Leave the access level at **Read**, then click **Share**. You should see: *Updating access…* for up to half a minute, then your collaborator listed under **Current Permissions**, with **Read**. 6. Close the dialog and look at the folder header. You should see: **Shared · 1** where it said **Private**. ## Check it worked Ask your collaborator to sign in to the portal, open **Data Browser**, and click **User Shared**. It lists a folder for each of many CyVerse users, 25 to a page. They find the folder named with your username, clicking **Next** if needed, and open it. They should see your shared folder and nothing else of yours. Inside it the header says **Read only**, and there is no **Upload**, **New Folder**, or **Share**. ## If it didn't **There is no Share button in the folder header.** The folder is not yours: **Share** appears only on folders you own. Check that the header says **Owner**. If you are in **Community**, **Shared**, or someone else's folder, go back to **My Files**. ## Next - Sharing a folder shares everything in it, including files you add later. To take access away, open the dialog again and click **Remove** beside the person's name. - [Add metadata to a file or folder](https://idss-mesa.github.io/trainings/tutorials/add-metadata/), so that the person you share with knows what they are looking at. - Reference: [Managing data, "Share data"](https://idss-mesa.github.io/docs/portal/data/#share-data), which also covers the other access levels and sharing several items at once. The dialog names them **Read & Write** and **Full Control**. *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-12 from the MESA documentation and followed once on the live portal on 2026-11-13.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/read-shared-metadata/ --- type: Guide title: "Read the metadata on a folder shared with you" description: "Open the metadata on a folder another CyVerse user has shared with you, in the MESA Portal's quick panel and on its full metadata page." tags: [byte, p1, portal, data-browser, metadata, sharing] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Read the metadata on a folder shared with you !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-13, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have read what a collaborator recorded about a folder, and found when it was created and who can reach it. **Time:** 5–10 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and a folder that a collaborator has [shared with you](https://idss-mesa.github.io/trainings/tutorials/share-a-folder/) after [adding metadata](https://idss-mesa.github.io/trainings/tutorials/add-metadata/) to it. Working in a pair, each of you can do this on the other's folder. ## Steps 1. In the sidebar, click **Data Browser**, then **User Shared**. Open the folder named with your collaborator's username. You should see: the folder they shared, and **Read only** in the header. 2. Click **AVUs** under the shared folder's name. You should see: a panel marked **READ ONLY** that lists each attribute, value, and unit, with the note *You can view these AVUs but not change them*. 3. Click **Open full metadata page** at the bottom of the panel. You should see: a page headed with the folder's name, the number of AVUs, and **Read-only**. The first tab, **Raw AVUs**, shows the same rows as the panel. 4. Click the **DataCite** tab. You should see: a form of standard fields for describing a dataset. A field is filled where the folder has an attribute of the same name, such as `description`. 5. Click the **iRODS** tab. You should see: the folder's path, the dates it was created and last modified, and under **Access Control** your own access, **read**. 6. Click **Back**. You should see: the Data Browser again. ## Check it worked You can say, without asking your collaborator, what the folder's `description` is and on what date the folder was created. ## If it didn't **The panel says there are no AVUs.** Your collaborator has not added any, or added them to a different folder. Ask them to check theirs under **My Files**. **Your collaborator's username is not on the first page of User Shared.** The list runs to several pages. Click **Next**, or set **Per page** to **100**. ## Next - [Add metadata to a file or folder](https://idss-mesa.github.io/trainings/tutorials/add-metadata/) of your own. - Reference: [Managing data, "Describe data with metadata (AVUs)"](https://idss-mesa.github.io/docs/portal/data/#describe-data-with-metadata-avus). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/stop-sharing-a-folder/ --- type: Guide title: "Stop sharing a folder" description: "Take away a collaborator's access to a folder in your Data Store from the MESA Portal's share dialog, and confirm the folder is private again." tags: [byte, p1, portal, data-browser, sharing] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Stop sharing a folder !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-13, by the AI assistant that drafted them. The browser used for the test could not show the confirmation box in step 4, so it was accepted automatically; its wording is as the portal sends it. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have removed one person's access to a folder, and seen the folder marked private again. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and a folder you have [shared with a collaborator](https://idss-mesa.github.io/trainings/tutorials/share-a-folder/). ## Steps 1. In the sidebar, click **Data Browser**, then **My Files**, and open the shared folder. You should see: **Shared · 1** in the folder header, or a higher number if you shared it with more people. 2. Click **Share** in the folder header. You should see: the share dialog. Under **Current Permissions** are you, as **OWNER**, and each person you shared with, with their access level and a **Remove** button. 3. Click **Remove** beside the person's name. You should see: your browser ask *Remove access for …?*, naming the person and the folder. 4. Click **OK**. You should see: *Updating access…* for up to half a minute, then the person gone from the list. If nobody else has access, the list says *Not shared with anyone else*. 5. Click **Close** and look at the folder header. You should see: **Private** where it said **Shared · 1**. ## Check it worked Ask the person to open **User Shared** and the folder named with your username. The folder you stopped sharing is no longer listed there. ## If it didn't **The header still says Shared.** Someone else still has access, or one of the two **Public Access** boxes in the dialog is ticked. Open the dialog again and look at both. ## Next - The two **Public Access** boxes are different from sharing with a named person. **All CyVerse Users** lets every CyVerse account read the folder. **Anyone without login** lets anyone on the internet read it and find it by browsing your home folder on data.cyverse.org. Leave both unticked unless you mean to publish. - Removing access does not take back copies. Anything the person already downloaded or copied stays with them. - Reference: [Managing data, "Share data"](https://idss-mesa.github.io/docs/portal/data/#share-data). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/share-an-analysis/ --- type: Guide title: "Share an analysis with a collaborator" description: "Give another CyVerse user read access to one of your analyses from the Analyses page of the MESA Portal, and confirm they are listed." tags: [byte, p1, portal, analyses, sharing] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/analyses/" title: "Managing analyses in the MESA Portal" author: "team:idss-mesa" --- # Share an analysis with a collaborator !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-16, by the AI assistant that drafted them. The collaborator's side was not checked. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have one of your analyses shared with a collaborator, who can see it but not change it. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), an analysis of your own, such as one from [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/), and your collaborator's CyVerse username. ## Steps 1. In the sidebar, click **Analyses**. If the analysis has finished, click the **Completed Analyses** heading to unfold the list. You should see: a card for the analysis, with **Share** among its buttons. 2. Click **Share**. You should see: a window headed **Share** and the analysis's name, with **Share with User** and **Current Permissions**, which lists only you, marked **own**. ![Sharing a running analysis with another CyVerse user](https://idss-mesa.github.io/docs/assets/portal/analyses-share.webp) 3. Under **Share with User**, type your collaborator's complete CyVerse username. You should see: the username offered on a line under the box. 4. Click that line. You should see: the line go, and the username stay in the box. 5. Leave the access level at **Read Only**, then click **Share**. You should see: the box empty again. The new name may not be listed yet. 6. Click **Close**, then click **Share** on the same card again. You should see: your collaborator under **Current Permissions**, marked **read**. ## Check it worked **Current Permissions** lists two names: yours with **own** and your collaborator's with **read**. Sharing the analysis does not share your files: what you saved under `~/data-store` stays private until you [share that folder](https://idss-mesa.github.io/trainings/tutorials/share-a-folder/). ## If it didn't **No line appears under the box.** The portal offers only usernames that exist. Check the spelling with your collaborator; it needs the whole username. **There is no Share button on the card.** **Share** is offered on running and completed analyses. A failed or canceled one has none. **You shared with the wrong person.** Open the window again and click the red **×** beside their name. This was not tried when the tutorial was written. ## Next - [Share a folder with a collaborator](https://idss-mesa.github.io/trainings/tutorials/share-a-folder/) - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/) - Reference: [Managing analyses](https://idss-mesa.github.io/docs/portal/analyses/). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16 and followed once on the live portal that day, from the sharing side only.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/find-a-working-group/ --- type: Guide title: "Find a MESA working group and how to join it" description: "Search the Working Groups page of the MESA Portal, open a group's page, and read what the group is for and who may join, before you ask to join." tags: [byte, p1, portal, working-groups, community] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/overview/" title: "The MESA Portal overview" author: "team:idss-mesa" --- # Find a MESA working group and how to join it !!! warning "Draft: not yet validated" These steps were followed once on the live portal on 2026-11-16, by the AI assistant that drafted them. **Request to Join** was not clicked. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** know which MESA working groups exist, what one of them is for, and what it asks of people who want to join. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/). ## Steps 1. In the sidebar, click **Working Groups**. You should see: a card for each group, with its name, a short description, its number of members, and a few tags. The header counts the groups. 2. In the search box, type a word from your field, for example `synthesis`. You should see: only the cards whose name, description, or tags hold that word. On the day this was written, `synthesis` left two of seven. 3. Clear the search box. You should see: every card again. 4. On a card that interests you, click **View details**. You should see: the group's own page, with its name in the header and a **Request to Join** button. 5. Read **About This Working Group**. You should see: what the group studies, who leads it, and often the Data Store folder where it keeps shared data, such as a folder under `/iplant/home/shared/`. 6. Scroll to **Requirements to Join** and read it. You should see: who the group is for, and how requests are decided. Do not click **Request to Join** unless you fit and mean to take part: the request goes to the group's owners. ## Check it worked You can name one group, say in a sentence what it is for, and say whether its requirements fit you. Your **Home** page lists the groups you belong to under **My Working Groups**; until you have joined one it reads *You're not in any working groups yet*. ## If it didn't **The search leaves no cards.** No group uses that word. Try a broader one, or clear the box and read the tags on the cards. **A group's page has no Request to Join button.** You may already be a member, or have a request waiting. Look for the group under **My Working Groups** on **Home**. This case was not seen when the tutorial was written. ## Next - [Find MESA's community data in the Data Browser](https://idss-mesa.github.io/trainings/tutorials/find-community-data/), where groups' shared folders are. - [Find your way around the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/find-your-way-around/) - Reference: [The MESA Portal overview](https://idss-mesa.github.io/docs/portal/overview/). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16 and followed once on the live portal that day, without asking to join a group.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/practice-data/ --- type: Reference title: "Practice data: five invented rain gauges" description: "The synthetic rain-gauge practice dataset used by the data tutorials: what its five files contain, its data dictionary, and how to copy it into your Data Store." tags: [practice-data, p2, data-dictionary, jupyterlab] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: python resource: "https://docs.python.org/3/library/urllib.request.html" title: "urllib.request (Python standard library)" author: "team:python" --- # Practice data: five invented rain gauges !!! warning "Draft: not yet validated" The download below was run once in MESA JupyterLab with the first four files, before `readings_august.csv` was added. Nobody has yet followed this page from start to finish. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). The data tutorials on this site all use the same few small files, so you can practise a technique without first finding a dataset. **The data is synthetic.** It was generated for these tutorials by [`scripts/make_practice_data.py`](https://github.com/idss-mesa/trainings/blob/main/scripts/make_practice_data.py): five invented rain gauges, with daily readings for July and August 2026 and one week of hourly observations from one of them. It describes no real place and no real measurement. Like real data, it is not perfectly clean, and the tutorials show you how to find out where. ## The files | File | Rows | One row is | | --- | --- | --- | | [`gauges.csv`](https://idss-mesa.github.io/trainings/assets/practice/gauges.csv) | 5 | one rain gauge | | [`readings.csv`](https://idss-mesa.github.io/trainings/assets/practice/readings.csv) | 152 | one reading from one gauge, July 2026 | | [`readings_august.csv`](https://idss-mesa.github.io/trainings/assets/practice/readings_august.csv) | 151 | one reading from one gauge, August 2026 | | [`observations.csv`](https://idss-mesa.github.io/trainings/assets/practice/observations.csv) | 336 | one hourly measurement of one kind | | [`gauge_sites.csv`](https://idss-mesa.github.io/trainings/assets/practice/gauge_sites.csv) | 5 | the position of one rain gauge | ## Data dictionary **gauges.csv** | Column | Meaning | | --- | --- | | `gauge_id` | Identifier, `G01` to `G05` | | `name` | Boathouse, Orchard, Observatory, Depot, or Quarry | | `unit` | The unit this gauge reports in | | `elevation_m` | Elevation in metres | **readings.csv** and **readings_august.csv** The two files have the same columns. The first holds July 2026 and the second August 2026. The tutorials use `readings.csv` unless they say otherwise. | Column | Meaning | | --- | --- | | `gauge_id` | Which gauge took the reading | | `date` | Day of the reading, as `YYYY-MM-DD` | | `value` | Rainfall for that day, in the gauge's own unit | | `flag` | Blank, or `S` for a reading the sensor marked suspect | **gauge_sites.csv** | Column | Meaning | | --- | --- | | `gauge_id` | Which gauge | | `longitude` | Longitude in decimal degrees, WGS 84; negative is west | | `latitude` | Latitude in decimal degrees, WGS 84 | The coordinates are invented and mark no real instruments. **observations.csv** | Column | Meaning | | --- | --- | | `gauge_id` | Which gauge; all rows are from `G03`, Observatory | | `timestamp_utc` | Start of the hour, in UTC, as `YYYY-MM-DDTHH:MM:SSZ` | | `measurement` | What was measured: `rain_mm` (rainfall in the hour, in millimetres) or `air_temp_c` (air temperature, in degrees Celsius) | | `value` | The measured number, in the unit its `measurement` names | The invented campus keeps US Mountain Time (`America/Denver`), six hours behind UTC in July. The observations cover 10 to 16 July 2026 in local time. ## Copy the files into your Data Store 1. In [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), double-click **home** in the file browser, then the folder named after your CyVerse username. 2. Click the **New Folder** button, name the folder `mesa-practice`, and open it. 3. Choose **File → New → Notebook**. In the **Select Kernel** box, change the choice to **Python 3 (ipykernel)** (it starts on another language) and click **Select**. Then run this cell: ```python from urllib.request import urlretrieve base = "https://idss-mesa.github.io/trainings/assets/practice/" for name in ["gauges.csv", "readings.csv", "readings_august.csv", "observations.csv", "gauge_sites.csv"]: urlretrieve(base + name, name) ``` The five files then appear in `mesa-practice`, beside the notebook. Because the folder is in your Data Store, they are still there the next time you start an app. You can also download the files from the links above and upload them with the portal's Data Browser; see [Managing data, "Upload, create, move, and delete"](https://idss-mesa.github.io/docs/portal/data/#upload-create-move-and-delete). ## Next - [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/) The practice data is released under [CC BY 4.0](https://idss-mesa.github.io/trainings/about/license/), like the rest of this site. *This page was drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/load-a-file/ --- type: Guide title: "Load a file from your Data Store into a notebook" description: "Read a CSV file that sits in your Data Store into a pandas table in MESA JupyterLab and confirm its size against what you expected." tags: [byte, p2, jupyterlab, data-store, pandas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-12T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html" title: "pandas.read_csv" author: "team:pandas-dev" --- # Load a file from your Data Store into a notebook !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-13 and produced the output shown. The steps were followed there once on 2026-11-16 by the AI assistant that drafted the page. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have both practice files loaded as tables in a notebook, with a row count you have checked. **Time:** 5 minutes. **You need:** [MESA JupyterLab running](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), and the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/) in a `mesa-practice` folder in your Data Store. ## Steps 1. In JupyterLab's file browser, open your `mesa-practice` folder. You should see: `gauges.csv` and `readings.csv`. 2. Choose **File → New → Notebook**. In the **Select Kernel** box, change the choice to **Python 3 (ipykernel)** (it starts on another language) and click **Select**. Then choose **File → Rename Notebook…**. In the **Rename File** box the part of the name before `.ipynb` is already selected: type `practice` over it and click **Rename**. You should see: `practice.ipynb` in the file browser, beside the two CSV files. 3. Type this into the first cell and press ++shift+enter++: ```python import pandas as pd readings = pd.read_csv("readings.csv") gauges = pd.read_csv("gauges.csv") ``` You should see: no output and no error. A file name with no folder in front of it means "in the same folder as this notebook". 4. In the next cell, run: ```python readings.shape ``` You should see: the number of rows, then the number of columns. ```text (152, 4) ``` 5. Run: ```python readings.head() ``` You should see: the first five rows. `NaN` in `flag` is how pandas shows a blank. ```text gauge_id date value flag 0 G01 2026-07-01 0.0 NaN 1 G01 2026-07-02 0.0 NaN 2 G01 2026-07-03 24.9 NaN 3 G01 2026-07-04 0.0 NaN 4 G01 2026-07-05 17.6 NaN ``` 6. Choose **File → Save Notebook**. You should see: the dot on the notebook's tab disappear. ## Check it worked `readings.shape` is `(152, 4)` and `gauges.shape` is `(5, 4)`, the sizes the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/) page gives. A different count means you loaded a different file, or only part of this one. ## If it didn't **The notebook is named `practice.ipynb.ipynb`.** You typed the ending as well as the name. Choose **File → Rename Notebook…** again and remove one `.ipynb`. **`FileNotFoundError: [Errno 2] No such file or directory: 'readings.csv'`.** The notebook is not in the same folder as the files. In the file browser, drag `practice.ipynb` into `mesa-practice`, then choose **Kernel → Restart Kernel…** and run the first cell again. ## Next - The same task in R: [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/). - [Read the data dictionary before the data](https://idss-mesa.github.io/trainings/tutorials/read-the-data-dictionary/) - Reference: [pandas.read_csv](https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html), and [MESA JupyterLab](https://idss-mesa.github.io/docs/apps/jupyterlab/) for what the app contains. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-12; the code was run there on 2026-11-13 and the steps followed once on 2026-11-16 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/read-the-data-dictionary/ --- type: Guide title: "Read the data dictionary before the data" description: "Use a dataset's data dictionary to find out what each column means and which column you cannot yet add up, before you compute anything." tags: [byte, p2, data-dictionary, units, pandas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-12T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/user_guide/indexing.html" title: "Indexing and selecting data (pandas user guide)" author: "team:pandas-dev" --- # Read the data dictionary before the data !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-13 and produced the output shown. The Markdown-cell step was followed there on 2026-11-16 by the AI assistant that drafted the page. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A *data dictionary* is the table that says what each column means. Five minutes with it saves you from a number that looks right and is not. **You will:** be able to say what one row of `readings.csv` is, and why its `value` column cannot simply be added up across gauges. **Time:** 5 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run so that `readings` and `gauges` exist. ## Steps 1. Open the [data dictionary](https://idss-mesa.github.io/trainings/tutorials/practice-data/#data-dictionary) for the practice data and read the four rows for `readings.csv`. You should see: that one row is one reading, from one gauge, for one day. 2. Read the meaning of `value` again, slowly. You should see: "in the gauge's own unit". The column does not promise one unit. 3. Find where the unit is recorded. Read the four rows for `gauges.csv`. You should see: a `unit` column, one value for each gauge. 4. In your notebook, run: ```python gauges[["gauge_id", "name", "unit"]] ``` You should see: ```text gauge_id name unit 0 G01 Boathouse mm 1 G02 Orchard cm 2 G03 Observatory mm 3 G04 Depot mm 4 G05 Quarry mm ``` 5. Compare the largest reading at each gauge: ```python readings.groupby("gauge_id")["value"].max() ``` You should see: G02's largest reading far below its neighbours'. The dictionary has already told you why: G02 reports in centimetres, the others in millimetres. 6. In a Markdown cell (press ++esc++, then ++m++), write one sentence of your own that says what `value` holds and what must happen before values from different gauges are compared. You should see: your sentence, rendered, after you press ++shift+enter++. ## Check it worked Without looking at this page, you can name the gauge that reports in a different unit and the file that told you so. ## If it didn't **`NameError: name 'gauges' is not defined`.** The kernel has restarted since you loaded the files. Run the notebook's first cell again, then repeat the step. ## Next - [Check a column's range and missing values](https://idss-mesa.github.io/trainings/tutorials/check-range-and-missing/) - Reference: the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/) page, which holds the dictionary. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-12; the code was run there on 2026-11-13 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/check-range-and-missing/ --- type: Guide title: "Check a column's range and missing values" description: "Find the smallest and largest value in a column and count the blanks in every column, so that an impossible value or a gap shows up before you compute with it." tags: [byte, p2, data-quality, missing-values, pandas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-12T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/user_guide/missing_data.html" title: "Working with missing data (pandas user guide)" author: "team:pandas-dev" --- # Check a column's range and missing values !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-13 and produced the output shown. Nobody has yet followed the steps there by hand, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** know the range of `value` at each gauge and how many blanks each column of `readings` holds. **Time:** 5 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run so that `readings` and `gauges` exist. ## Steps 1. Run: ```python readings["value"].min(), readings["value"].max() ``` You should see: `0.0` and `180.0`. Depending on the pandas version, each number may be wrapped as `np.float64(...)`. 2. Ask whether both ends are believable. Zero is a dry day. Decide whether 180 could be one day's rain before you read on. You should see: a reason to look closer. A range tells you that something is unusual, not what it is. 3. Split the range by gauge: ```python readings.groupby("gauge_id")["value"].agg(["min", "max"]) ``` You should see: ```text min max gauge_id G01 0.0 24.90 G02 0.0 2.92 G03 0.0 32.50 G04 0.0 26.40 G05 0.0 180.00 ``` 4. Count the blanks in every column: ```python readings.isna().sum() ``` You should see: ```text gauge_id 0 date 0 value 0 flag 150 dtype: int64 ``` 5. Check the blanks against the [data dictionary](https://idss-mesa.github.io/trainings/tutorials/practice-data/#data-dictionary). You should see: that a blank `flag` is expected, since it means the sensor raised no concern, and that `value` is never blank. ## Check it worked You can state two things: the largest `value` at each gauge, and that the only column with blanks is `flag`, with 150 of them. ## If it didn't **The counts in step 4 are all zero.** `flag` was read as empty text, not as missing. That happens when the file is loaded with `keep_default_na=False`. Load it again with plain `pd.read_csv("readings.csv")`. ## Next - [Tally a quality flag before you trust a number](https://idss-mesa.github.io/trainings/tutorials/tally-a-quality-flag/), which follows up the 180. - "No blank values" does not mean "no missing days": a day with no row at all is not a blank. [Count records per day to find incomplete days](https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/) covers that. - Reference: [Working with missing data](https://pandas.pydata.org/docs/user_guide/missing_data.html) in the pandas user guide. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-12; the code was run there on 2026-11-13 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/tally-a-quality-flag/ --- type: Guide title: "Tally a quality flag before you trust a number" description: "Count how many rows carry each value of a quality flag, including the blanks, and look at the flagged rows before deciding what to do with them." tags: [byte, p2, data-quality, quality-flag, pandas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-12T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/reference/api/pandas.Series.value_counts.html" title: "pandas.Series.value_counts" author: "team:pandas-dev" --- # Tally a quality flag before you trust a number !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-13 and produced the output shown. Nobody has yet followed the steps there by hand, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Many datasets carry a column in which the instrument or the provider marks readings it doubts. A total computed without looking at that column includes those readings. **You will:** know how many readings are flagged, which ones, and at which gauges. **Time:** 5 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run so that `readings` and `gauges` exist. ## Steps 1. Read what the flag means in the [data dictionary](https://idss-mesa.github.io/trainings/tutorials/practice-data/#data-dictionary). You should see: blank, or `S` for a reading the sensor marked suspect. 2. Count the rows for each flag value, blanks included: ```python readings["flag"].value_counts(dropna=False) ``` You should see: ```text flag NaN 150 S 2 Name: count, dtype: int64 ``` 3. Check that nothing is left over: 150 + 2 = 152, the number of rows in the table. You should see: the counts add up, and no flag value that the dictionary does not list. 4. Look at the flagged rows: ```python readings[readings["flag"] == "S"] ``` You should see: ```text gauge_id date value flag 76 G03 2026-07-18 0.0 S 129 G05 2026-07-09 180.0 S ``` 5. Count flags by gauge: ```python pd.crosstab(readings["gauge_id"], readings["flag"].fillna("blank")) ``` You should see: ```text flag S blank gauge_id G01 0 27 G02 0 31 G03 1 31 G04 0 31 G05 1 30 ``` 6. In a Markdown cell, write down what you will do with flagged readings and why: keep them, leave them out, or report the result both ways. You should see: your decision recorded in the notebook, where a reader of your result can find it. ## Check it worked You can say how many readings are flagged (2), where they are, and what your analysis does with them. The tally does not make that decision for you. A flag marks a doubt, not an error: one of these readings is far outside its gauge's range, the other is an ordinary dry day. ## If it didn't **The tally shows only `S 2`.** `dropna=False` is missing, so the blanks were left out and you cannot check the counts against the row total. Add it and run the cell again. ## Next - [Count records per day to find incomplete days](https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/) - Reference: [pandas.Series.value_counts](https://pandas.pydata.org/docs/reference/api/pandas.Series.value_counts.html) and [pandas.crosstab](https://pandas.pydata.org/docs/reference/api/pandas.crosstab.html). *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-12; the code was run there on 2026-11-13 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/ --- type: Guide title: "Count records per day to find incomplete days" description: "Count the rows for each gauge and day to find days that were recorded twice and days that were not recorded at all." tags: [byte, p2, data-quality, completeness, pandas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-12T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/user_guide/groupby.html" title: "Group by: split-apply-combine (pandas user guide)" author: "team:pandas-dev" --- # Count records per day to find incomplete days !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-13 and produced the output shown. Nobody has yet followed the steps there by hand, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). The data dictionary says one row is one reading for one gauge on one day. This tutorial tests that claim. A day counted twice inflates a total, and a missing day shrinks it, and neither shows up as a blank value. **You will:** know, for each gauge, whether July has exactly one row per day. **Time:** 5 to 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run so that `readings` and `gauges` exist. ## Steps 1. Work out what a complete table would hold: 5 gauges × 31 days in July. You should see: 155. The table has 152 rows, so something is uneven. 2. Count the rows for each gauge: ```python readings.groupby("gauge_id").size() ``` You should see: ```text gauge_id G01 27 G02 31 G03 32 G04 31 G05 31 dtype: int64 ``` 3. Count the *distinct* days for each gauge: ```python readings.groupby("gauge_id")["date"].nunique() ``` You should see: G03 with 31 days, not 32, and G01 still with 27. ```text gauge_id G01 27 G02 31 G03 31 G04 31 G05 31 Name: date, dtype: int64 ``` 4. Find any gauge and day with more than one row: ```python per_day = readings.groupby(["gauge_id", "date"]).size() per_day[per_day != 1] ``` You should see: ```text gauge_id date G03 2026-07-05 2 dtype: int64 ``` 5. List the days on which G01 has no row: ```python july = pd.date_range("2026-07-01", "2026-07-31").strftime("%Y-%m-%d") sorted(set(july) - set(readings.loc[readings["gauge_id"] == "G01", "date"])) ``` You should see: four consecutive days. ```text ['2026-07-22', '2026-07-23', '2026-07-24', '2026-07-25'] ``` 6. In a Markdown cell, note both findings and what each does to a monthly total. You should see: your note in the notebook, beside the evidence. ## Check it worked The numbers reconcile: 155 expected rows, plus 1 repeated row, minus 4 missing days, is 152, the size of the table. ## If it didn't **Step 4 returns an empty result.** You ran it on a table from which repeated rows had already been removed, for example after `drop_duplicates()`. Run the notebook's first cell again to reload the file, then repeat the step. ## Next - [Turn UTC timestamps into local days](https://idss-mesa.github.io/trainings/tutorials/local-days-from-utc/) - [Reconcile row counts before and after a join](https://idss-mesa.github.io/trainings/tutorials/reconcile-a-join/) - Reference: [Group by: split-apply-combine](https://pandas.pydata.org/docs/user_guide/groupby.html) in the pandas user guide. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-12; the code was run there on 2026-11-13 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/local-days-from-utc/ --- type: Guide title: "Turn UTC timestamps into local days" description: "Convert UTC timestamps to local time before grouping by day, and confirm the daily totals against values you already trust." tags: [byte, p2, time-zones, timestamps, pandas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/user_guide/timeseries.html#time-zone-handling" title: "Time zone handling (pandas user guide)" author: "team:pandas-dev" --- # Turn UTC timestamps into local days !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-13 and produced the output shown. Nobody has yet followed the steps there by hand, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Instruments usually record time in UTC. A "day" of UTC is not a day where the instrument stands: on the invented campus, which keeps US Mountain Time, the UTC date changes at six in the evening in July. Evening rain lands on the wrong day unless you convert first. **You will:** have daily rain totals by local day that match the gauge's daily record. **Time:** 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run. ## Steps 1. Check that `observations.csv` is in your `mesa-practice` folder. If it is not, run the download cell on the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/) page again. Then run: ```python obs = pd.read_csv("observations.csv") obs.shape ``` You should see: ```text (336, 4) ``` 2. Keep the rain rows and turn the text timestamps into real ones: ```python rain = obs[obs["measurement"] == "rain_mm"].copy() rain["time_utc"] = pd.to_datetime(rain["timestamp_utc"]) rain["time_utc"].dt.tz ``` You should see: `UTC`. The trailing `Z` in the file told pandas the zone. 3. Total the rain by UTC date: ```python rain.groupby(rain["time_utc"].dt.date)["value"].sum() ``` You should see: eight dates for a seven-day week, the first sign of trouble. ```text time_utc 2026-07-10 0.0 2026-07-11 32.4 2026-07-12 7.4 2026-07-13 17.6 2026-07-14 4.4 2026-07-15 22.1 2026-07-16 1.7 2026-07-17 0.0 Name: value, dtype: float64 ``` 4. Convert to local time and total again: ```python rain["time_local"] = rain["time_utc"].dt.tz_convert("America/Denver") rain.groupby(rain["time_local"].dt.date)["value"].sum() ``` You should see: seven dates, and different totals. ```text time_local 2026-07-10 32.4 2026-07-11 0.0 2026-07-12 23.0 2026-07-13 6.4 2026-07-14 22.1 2026-07-15 1.7 2026-07-16 0.0 Name: value, dtype: float64 ``` 5. Compare with the same gauge's daily record: ```python week = readings["date"].between("2026-07-10", "2026-07-16") readings[(readings["gauge_id"] == "G03") & week][["date", "value"]] ``` You should see: the seven totals from step 4, not those from step 3. ## Check it worked Your local-day totals equal the daily values in `readings.csv` for G03, day for day. The week's total is 85.6 mm either way; only the days it falls on change. ## If it didn't **`TypeError: Cannot convert tz-naive timestamps, use tz_localize to localize`.** The timestamps were read without a zone, which happens when a file's times have no `Z` or offset. Say what zone they are in first: `rain["time_utc"].dt.tz_localize("UTC")`, then convert. ## Next - [Work with a long table, one row per kind of measurement](https://idss-mesa.github.io/trainings/tutorials/work-with-a-long-table/) - Reference: [Time zone handling](https://pandas.pydata.org/docs/user_guide/timeseries.html#time-zone-handling) in the pandas user guide. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13; the code was run there on 2026-11-13 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/work-with-a-long-table/ --- type: Guide title: "Work with a long table, one row per kind of measurement" description: "Recognise a table that stacks several kinds of measurement in one value column, summarise each kind separately, and reshape it to one column per measurement." tags: [byte, p2, long-format, reshaping, pandas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/user_guide/reshaping.html" title: "Reshaping and pivot tables (pandas user guide)" author: "team:pandas-dev" --- # Work with a long table, one row per kind of measurement !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-13 and produced the output shown. Nobody has yet followed the steps there by hand, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Many archives store data *long*: one row per time and per kind of measurement, with the number in a single `value` column. It is a tidy way to store data and an easy way to average rainfall with temperature by accident. **You will:** have the hourly observations summarised by measurement and reshaped to one column for each. **Time:** 5 to 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run. ## Steps 1. Check that `observations.csv` is in your `mesa-practice` folder. If it is not, run the download cell on the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/) page again. Then run: ```python obs = pd.read_csv("observations.csv") obs.shape ``` You should see: ```text (336, 4) ``` 2. Look at the first rows: ```python obs.head() ``` You should see: each timestamp twice, once for each kind of measurement. ```text gauge_id timestamp_utc measurement value 0 G03 2026-07-10T06:00:00Z rain_mm 0.0 1 G03 2026-07-10T06:00:00Z air_temp_c 13.8 2 G03 2026-07-10T07:00:00Z rain_mm 0.0 3 G03 2026-07-10T07:00:00Z air_temp_c 12.3 4 G03 2026-07-10T08:00:00Z rain_mm 0.0 ``` 3. Count the rows for each kind: ```python obs["measurement"].value_counts() ``` You should see: ```text measurement rain_mm 168 air_temp_c 168 Name: count, dtype: int64 ``` 4. Summarise each kind on its own: ```python obs.groupby("measurement")["value"].agg(["min", "max", "mean"]).round(2) ``` You should see: two rows with nothing in common. `obs["value"].mean()` would have returned 9.27, a number that is neither millimetres nor degrees. ```text min max mean measurement air_temp_c 10.2 25.4 18.03 rain_mm 0.0 15.8 0.51 ``` 5. Reshape to one column per measurement: ```python wide = obs.pivot(index="timestamp_utc", columns="measurement", values="value") wide.head(3) ``` You should see: ```text measurement air_temp_c rain_mm timestamp_utc 2026-07-10T06:00:00Z 13.8 0.0 2026-07-10T07:00:00Z 12.3 0.0 2026-07-10T08:00:00Z 10.7 0.0 ``` 6. Check the reshape lost nothing: ```python wide.shape ``` You should see: `(168, 2)`. ## Check it worked The counts reconcile: 168 hours × 2 measurements is 336, the number of rows you started with, and `wide` has no empty cells (`wide.isna().sum().sum()` is 0). ## If it didn't **`ValueError: Index contains duplicate entries, cannot reshape`.** Some timestamp has two rows for the same measurement, so pandas cannot tell which value belongs in the cell. Find them with `obs[obs.duplicated(["timestamp_utc", "measurement"], keep=False)]` and settle which is right before you reshape. ## Next - [Turn UTC timestamps into local days](https://idss-mesa.github.io/trainings/tutorials/local-days-from-utc/) - Reference: [Reshaping and pivot tables](https://pandas.pydata.org/docs/user_guide/reshaping.html) in the pandas user guide. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13; the code was run there on 2026-11-13 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/ --- type: Guide title: "Load a file from your Data Store in RStudio" description: "Read a CSV file from your Data Store into an R data frame in MESA RStudio Geospatial, and confirm its size and column types." tags: [byte, p2, rstudio, r, data-store] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/utils/html/read.table.html" title: "Data Input: read.table and read.csv (R documentation)" author: "team:r-core" --- # Load a file from your Data Store in RStudio !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-13 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown, one step at a time. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** have the practice readings loaded as an R data frame, with a row count you have checked. **Time:** 5 to 10 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and your CyVerse username. ## Steps 1. In the portal, click **Applications**, and on the **MESA RStudio Geospatial** card click **Instant Launch**. Wait for RStudio to open. You should see: RStudio, with the **Console** on the left. 2. In the **Console**, go to a practice folder in your Data Store and fetch the files, with your own username in the first line: ```r setwd("~/data-store/home/") dir.create("mesa-practice", showWarnings = FALSE) setwd("mesa-practice") base <- "https://idss-mesa.github.io/trainings/assets/practice/" for (f in c("gauges.csv", "readings.csv")) download.file(paste0(base, f), f) ``` You should see: two lines that begin `downloaded`. 3. Read both files: ```r readings <- read.csv("readings.csv", na.strings = "") gauges <- read.csv("gauges.csv") ``` You should see: `readings` and `gauges` appear in the **Environment** tab at the top right. `na.strings = ""` tells R that an empty cell is a missing value, not an empty piece of text. 4. Check the size: ```r dim(readings) ``` You should see: rows, then columns. ```text [1] 152 4 ``` 5. Look at the first rows: ```r head(readings) ``` You should see: `` wherever `flag` was blank in the file. ```text gauge_id date value flag 1 G01 2026-07-01 0.0 2 G01 2026-07-02 0.0 3 G01 2026-07-03 24.9 4 G01 2026-07-04 0.0 5 G01 2026-07-05 17.6 6 G01 2026-07-06 0.0 ``` 6. Check what type each column was read as: ```r str(readings) ``` You should see: `value` as numbers (`num`), and `date` as text (`chr`). R did not turn the dates into dates; `as.Date(readings$date)` does that when you need it. ## Check it worked `dim(readings)` is `152 4`, the size the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/) page gives, and the **Environment** tab lists `readings` with 152 obs. of 4 variables. ## If it didn't **`cannot open file 'readings.csv': No such file or directory`.** R is not in the folder that holds the file. Run `getwd()` to see where it is, then repeat the `setwd()` lines in step 2 with your username spelled exactly. ## Next - [Tally a quality flag in R](https://idss-mesa.github.io/trainings/tutorials/r-tally-a-quality-flag/) - The same task in Python: [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/). - Reference: [MESA RStudio Geospatial](https://idss-mesa.github.io/docs/apps/rstudio/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-read-the-data-dictionary/ --- type: Guide title: "Read the data dictionary before the data, in R" description: "Use the practice data's dictionary to say what one row of the readings table is, then confirm in R which gauge reports in a different unit." tags: [byte, p2, rstudio, r, data-dictionary] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/base/html/tapply.html" title: "Apply a Function Over a Ragged Array: tapply (R documentation)" author: "team:r-core" --- # Read the data dictionary before the data, in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-16 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A *data dictionary* is the table that says what each column means. Five minutes with it saves you from a number that looks right and is not. **You will:** be able to say what one row of `readings.csv` is, and why its `value` column cannot simply be added up across gauges. **Time:** 5 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. Open the [data dictionary](https://idss-mesa.github.io/trainings/tutorials/practice-data/#data-dictionary) for the practice data and read the four rows for `readings.csv`. You should see: that one row is one reading, from one gauge, for one day. 2. Read the meaning of `value` again, slowly. You should see: "in the gauge's own unit". The column does not promise one unit. 3. Find where the unit is recorded. Read the four rows for `gauges.csv`. You should see: a `unit` column, one value for each gauge. 4. In the **Console**, run: ```r gauges[c("gauge_id", "name", "unit")] ``` You should see: ```text gauge_id name unit 1 G01 Boathouse mm 2 G02 Orchard cm 3 G03 Observatory mm 4 G04 Depot mm 5 G05 Quarry mm ``` 5. Compare the largest reading at each gauge: ```r tapply(readings$value, readings$gauge_id, max) ``` You should see: G02's largest reading far below its neighbours'. The dictionary has already told you why: G02 reports in centimetres, the others in millimetres. ```text G01 G02 G03 G04 G05 24.90 2.92 32.50 26.40 180.00 ``` 6. In a script or a notes file, write one sentence of your own that says what `value` holds and what must happen before values from different gauges are compared. You should see: your sentence where a reader of your result can find it. ## Check it worked Without looking at this page, you can name the gauge that reports in a different unit and the file that told you so. ## If it didn't **`object 'gauges' not found`.** R has restarted since you loaded the files. Read them again, as in [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), then repeat the step. ## Next - [Check a column's range and missing values in R](https://idss-mesa.github.io/trainings/tutorials/r-check-range-and-missing/) - [Bring two units onto one scale in R](https://idss-mesa.github.io/trainings/tutorials/r-convert-units-before-comparing/), which does the conversion the dictionary calls for. - The same task in Python: [Read the data dictionary before the data](https://idss-mesa.github.io/trainings/tutorials/read-the-data-dictionary/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-check-range-and-missing/ --- type: Guide title: "Check a column's range and missing values in R" description: "Find the smallest and largest value in a column and count the missing values in every column of an R data frame, so that an impossible value or a gap shows up before you compute with it." tags: [byte, p2, rstudio, r, data-quality, missing-values] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/base/html/NA.html" title: "Not Available / Missing Values: NA and is.na (R documentation)" author: "team:r-core" --- # Check a column's range and missing values in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-16 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown, one step at a time. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** know the range of `value` at each gauge and how many missing values each column of `readings` holds. **Time:** 5 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. In the **Console**, run: ```r range(readings$value) ``` You should see: the smallest value, then the largest. ```text [1] 0 180 ``` 2. Ask whether both ends are believable. Zero is a dry day. Decide whether 180 could be one day's rain before you read on. You should see: a reason to look closer. A range tells you that something is unusual, not what it is. 3. Split the range by gauge: ```r aggregate(value ~ gauge_id, data = readings, FUN = function(v) c(min = min(v), max = max(v))) ``` You should see: ```text gauge_id value.min value.max 1 G01 0.00 24.90 2 G02 0.00 2.92 3 G03 0.00 32.50 4 G04 0.00 26.40 5 G05 0.00 180.00 ``` 4. Count the missing values in every column: ```r colSums(is.na(readings)) ``` You should see: ```text gauge_id date value flag 0 0 0 150 ``` 5. Check the count against the [data dictionary](https://idss-mesa.github.io/trainings/tutorials/practice-data/#data-dictionary). You should see: that a blank `flag` is expected, since it means the sensor raised no concern, and that `value` is never missing. ## Check it worked You can state two things: the largest `value` at each gauge, and that the only column with missing values is `flag`, with 150 of them. ## If it didn't **The counts in step 4 are all zero.** `flag` was read as empty text, not as missing. Read the file again with `na.strings = ""`, as in [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/). **Step 1 prints `[1] NA NA`.** The column holds a missing value, and `range()` will not guess around it. `range(readings$value, na.rm = TRUE)` leaves the missing values out; count them first, so you know how many you set aside. ## Next - [Tally a quality flag in R](https://idss-mesa.github.io/trainings/tutorials/r-tally-a-quality-flag/), which follows up the 180. - "No missing values" does not mean "no missing days": a day with no row at all is not an `NA`. [Count records per day in R](https://idss-mesa.github.io/trainings/tutorials/r-count-records-per-day/) covers that. - The same task in Python: [Check a column's range and missing values](https://idss-mesa.github.io/trainings/tutorials/check-range-and-missing/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-tally-a-quality-flag/ --- type: Guide title: "Tally a quality flag in R" description: "Count the rows for each value of a quality flag in R, including the missing ones, and look at the flagged rows before deciding what to do with them." tags: [byte, p2, rstudio, r, data-quality] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/base/html/table.html" title: "Cross Tabulation and Table Creation: table (R documentation)" author: "team:r-core" --- # Tally a quality flag in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-13 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown, one step at a time. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Many datasets mark the readings their instrument doubted. `table()` counts them, but by default it leaves missing values out, which hides how many rows carry no flag at all. **You will:** know how many readings are flagged, which ones, and at which gauges. **Time:** 5 minutes. **You need:** the `readings` table from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. Read what the flag means in the [data dictionary](https://idss-mesa.github.io/trainings/tutorials/practice-data/#data-dictionary). You should see: blank, or `S` for a reading the sensor marked suspect. 2. Count the rows for each flag value, missing ones included: ```r table(readings$flag, useNA = "always") ``` You should see: ```text S 2 150 ``` 3. Check that nothing is left over: 2 + 150 = 152, the number of rows. You should see: the counts add up, and no flag value the dictionary does not list. 4. Look at the flagged rows: ```r readings[which(readings$flag == "S"), ] ``` You should see: ```text gauge_id date value flag 77 G03 2026-07-18 0 S 130 G05 2026-07-09 180 S ``` 5. Count flags by gauge: ```r table(readings$gauge_id, readings$flag, useNA = "ifany") ``` You should see: ```text S G01 0 27 G02 0 31 G03 1 31 G04 0 31 G05 1 30 ``` 6. In a script or a notes file, write down what you will do with flagged readings and why: keep them, leave them out, or report the result both ways. You should see: your decision recorded where a reader of your result can find it. ## Check it worked You can say how many readings are flagged (2), where they are, and what your analysis does with them. One is far outside its gauge's range; the other is an ordinary dry day. ## If it didn't **Step 4 prints 152 rows, 150 of them all `NA`.** You wrote `readings[readings$flag == "S", ]` without `which()`. Comparing a missing value with `"S"` gives `NA`, and R returns a row of `NA` for each one. `which()` keeps only the rows where the comparison is true. ## Next - [Query a Parquet file with DuckDB from R](https://idss-mesa.github.io/trainings/tutorials/r-query-parquet-with-duckdb/) - The same task in Python: [Tally a quality flag before you trust a number](https://idss-mesa.github.io/trainings/tutorials/tally-a-quality-flag/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-count-records-per-day/ --- type: Guide title: "Count records per day in R" description: "Count the rows for each gauge and day in an R data frame to find days recorded twice and days with no record at all." tags: [byte, p2, rstudio, r, data-quality, completeness] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/stats/html/aggregate.html" title: "Compute Summary Statistics of Data Subsets: aggregate (R documentation)" author: "team:r-core" --- # Count records per day in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-16 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown, one step at a time. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). The data dictionary says one row is one reading for one gauge on one day. This tutorial tests that claim. A day counted twice inflates a total, and a missing day shrinks it, and neither shows up as an `NA`. **You will:** know, for each gauge, whether July has exactly one row per day. **Time:** 5 to 10 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. Work out what a complete table would hold: 5 gauges × 31 days in July. You should see: 155. The table has 152 rows, so something is uneven. 2. Count the rows for each gauge: ```r table(readings$gauge_id) ``` You should see: ```text G01 G02 G03 G04 G05 27 31 32 31 31 ``` 3. Count the *distinct* days for each gauge: ```r tapply(readings$date, readings$gauge_id, function(d) length(unique(d))) ``` You should see: G03 with 31 days, not 32, and G01 still with 27. ```text G01 G02 G03 G04 G05 27 31 31 31 31 ``` 4. Find any gauge and day with more than one row: ```r per_day <- aggregate(value ~ gauge_id + date, data = readings, FUN = length) per_day[per_day$value != 1, ] ``` You should see: one gauge and day, where the `value` column now holds the number of rows. ```text gauge_id date value 23 G03 2026-07-05 2 ``` 5. List the days on which G01 has no row: ```r july <- as.character(seq(as.Date("2026-07-01"), as.Date("2026-07-31"), by = "day")) setdiff(july, readings$date[readings$gauge_id == "G01"]) ``` You should see: four consecutive days. ```text [1] "2026-07-22" "2026-07-23" "2026-07-24" "2026-07-25" ``` 6. In a script or a notes file, note both findings and what each does to a monthly total. You should see: your note where a reader of your result can find it. ## Check it worked The numbers reconcile: 155 expected rows, plus 1 repeated row, minus 4 missing days, is 152, the size of the table. ## If it didn't **Step 4 prints `<0 rows>`.** You ran it on a table from which repeated rows had already been removed, for example with `unique()`. Read the file again, then repeat the step. **Step 5 lists all 31 days.** `date` is no longer text. `setdiff()` compares like with like, so compare text with text: use `as.character(readings$date)`. ## Next - [Query a Parquet file with DuckDB from R](https://idss-mesa.github.io/trainings/tutorials/r-query-parquet-with-duckdb/) - [Reconcile row counts before and after a join in R](https://idss-mesa.github.io/trainings/tutorials/r-reconcile-a-join/) - The same task in Python: [Count records per day to find incomplete days](https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/ --- type: Guide title: "Map point data with sf in MESA RStudio Geospatial" description: "Turn a table of longitudes and latitudes into spatial points with sf in MESA RStudio Geospatial, check a distance, and save a map to your Data Store." tags: [byte, p2, rstudio, geospatial, sf] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: sf resource: "https://r-spatial.github.io/sf/articles/sf1.html" title: "Simple Features for R (sf package documentation)" author: "team:r-spatial" --- # Map point data with sf in MESA RStudio Geospatial !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-13 (R 4.6.2, sf 1.1.3), by the AI assistant that drafted it, and produced the output and the map shown. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A column of longitudes and a column of latitudes are only numbers until you tell R they are positions. The `sf` package does that, and then distances and maps come from the same object. **You will:** have a map of the five practice gauges, saved as an image in your Data Store. **Time:** 10 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and your CyVerse username. ## Steps 1. In the portal, click **Applications**, and on the **MESA RStudio Geospatial** card click **Instant Launch**. Wait for RStudio to open. You should see: RStudio, with the **Console** on the left and a **Files** tab at the bottom right that lists `data-store`. 2. Click in the **Console**. Run these lines, with your own username in the first: ```r setwd("~/data-store/home/") dir.create("mesa-practice", showWarnings = FALSE) setwd("mesa-practice") base <- "https://idss-mesa.github.io/trainings/assets/practice/" for (f in c("gauges.csv", "gauge_sites.csv")) download.file(paste0(base, f), f) ``` You should see: `downloaded 135 bytes`, then `downloaded 144 bytes`. 3. Join the two tables and declare the coordinates: ```r library(sf) library(ggplot2) gauges <- read.csv("gauges.csv") sites <- read.csv("gauge_sites.csv") located <- merge(gauges, sites, by = "gauge_id") points <- st_as_sf(located, coords = c("longitude", "latitude"), crs = 4326) points ``` You should see: five features, a `geometry` column in place of the two coordinate columns, and the coordinate reference system you declared. `4326` is WGS 84, ordinary longitude and latitude. ```text Simple feature collection with 5 features and 4 fields Geometry type: POINT Dimension: XY Bounding box: xmin: -104.7612 ymin: 47.0962 xmax: -104.7228 ymax: 47.1287 Geodetic CRS: WGS 84 gauge_id name unit elevation_m geometry 1 G01 Boathouse mm 512 POINT (-104.7612 47.1034) 2 G02 Orchard cm 540 POINT (-104.7391 47.1108) 3 G03 Observatory mm 688 POINT (-104.7228 47.1287) 4 G04 Depot mm 521 POINT (-104.7533 47.1175) 5 G05 Quarry mm 603 POINT (-104.7306 47.0962) ``` 4. Check that R now treats them as positions, by asking for a distance: ```r boathouse <- points[points$name == "Boathouse", ] observatory <- points[points$name == "Observatory", ] round(st_distance(boathouse, observatory)) ``` You should see: the distance in metres, about four kilometres. ```text Units: [m] [,1] [1,] 4044 ``` 5. Draw the map: ```r ggplot(points) + geom_sf(aes(colour = elevation_m), size = 4) + geom_sf_text(aes(label = name), nudge_y = 0.002, fun.geometry = identity) + scale_x_continuous(expand = expansion(mult = 0.3)) + labs(colour = "Elevation (m)", x = NULL, y = NULL) ``` You should see: the **Plots** tab come forward at the bottom right, with five labelled points. ![Five labelled points on a longitude and latitude grid, coloured by elevation](https://idss-mesa.github.io/trainings/assets/tutorials/gauge-map.png){ width="520" } 6. Save it beside the data: ```r ggsave("gauge-map.png", width = 6, height = 4) ``` You should see: no output. The map is now a file in your Data Store. ## Check it worked In the portal, open **Data Browser → My Files → mesa-practice**. `gauge-map.png` is listed there, which means it will outlast the app. ## If it didn't **`cannot change working directory`** in step 2. The username in the path is not yours, or is misspelled. In the **Files** tab, click **data-store**, then **home**: the folder that is not `shared` is named after your username. ## Next - [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/) - [Stop an app and find your results](https://idss-mesa.github.io/trainings/tutorials/stop-app-find-results/), when you have finished with RStudio. - The coordinates are invented, like the rest of the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/): they mark no real instruments. - Reference: [MESA RStudio Geospatial](https://idss-mesa.github.io/docs/apps/rstudio/) for what the app contains, and [Simple Features for R](https://r-spatial.github.io/sf/articles/sf1.html). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13; the code was run there on 2026-11-13 (R 4.6.2, sf 1.1.3).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-local-days-from-utc/ --- type: Guide title: "Turn UTC timestamps into local days in R" description: "Read UTC timestamps as times in R, total hourly rain by UTC date and by local date, and confirm that only the local days match the gauge's daily record." tags: [byte, p2, rstudio, r, time-zones] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/base/html/as.POSIXlt.html" title: "Date-time Conversion Functions: as.POSIXct (R documentation)" author: "team:r-core" --- # Turn UTC timestamps into local days in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-16 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Instruments usually record time in UTC. A "day" of UTC is not a day where the instrument stands: on the invented campus, which keeps US Mountain Time, the UTC date changes at six in the evening in July. Evening rain lands on the wrong day unless you convert first. **You will:** have daily rain totals by local day that match the gauge's daily record. **Time:** 10 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. In the **Console**, fetch the hourly observations into your practice folder: ```r download.file("https://idss-mesa.github.io/trainings/assets/practice/observations.csv", "observations.csv") ``` You should see: a line that reads `downloaded 13 KB`. 2. Read the file and check its size: ```r obs <- read.csv("observations.csv") dim(obs) ``` You should see: ```text [1] 336 4 ``` 3. Keep the rain rows and turn the text timestamps into real times. Say that they are UTC; the trailing `Z` in the file means so, but R does not read it: ```r rain <- obs[obs$measurement == "rain_mm", ] rain$time_utc <- as.POSIXct(rain$timestamp_utc, format = "%Y-%m-%dT%H:%M:%SZ", tz = "UTC") attr(rain$time_utc, "tzone") ``` You should see: ```text [1] "UTC" ``` 4. Total the rain by UTC date: ```r rain$day_utc <- format(rain$time_utc, "%Y-%m-%d") aggregate(value ~ day_utc, data = rain, FUN = sum) ``` You should see: eight dates for a seven-day week, the first sign of trouble. ```text day_utc value 1 2026-07-10 0.0 2 2026-07-11 32.4 3 2026-07-12 7.4 4 2026-07-13 17.6 5 2026-07-14 4.4 6 2026-07-15 22.1 7 2026-07-16 1.7 8 2026-07-17 0.0 ``` 5. Write each time as a date in the local zone, and total again: ```r rain$day_local <- format(rain$time_utc, "%Y-%m-%d", tz = "America/Denver") aggregate(value ~ day_local, data = rain, FUN = sum) ``` You should see: seven dates, and different totals. ```text day_local value 1 2026-07-10 32.4 2 2026-07-11 0.0 3 2026-07-12 23.0 4 2026-07-13 6.4 5 2026-07-14 22.1 6 2026-07-15 1.7 7 2026-07-16 0.0 ``` 6. Compare with the same gauge's daily record: ```r week <- readings$date >= "2026-07-10" & readings$date <= "2026-07-16" readings[readings$gauge_id == "G03" & week, c("date", "value")] ``` You should see: the seven totals from step 5, not those from step 4. ```text date value 69 2026-07-10 32.4 70 2026-07-11 0.0 71 2026-07-12 23.0 72 2026-07-13 6.4 73 2026-07-14 22.1 74 2026-07-15 1.7 75 2026-07-16 0.0 ``` ## Check it worked Your local-day totals equal the daily values in `readings.csv` for G03, day for day. `sum(rain$value)` is 85.6 either way; only the days it falls on change. ## If it didn't **The totals in step 4 already look like local days, or are off by hours.** You left out `tz = "UTC"` in step 3. R then takes the times to be in the app's own zone, which in MESA RStudio Geospatial is not UTC, and gives no warning. Run step 3 again as written. **Every `time_utc` is `NA`.** The `format` does not match the text. It must describe the timestamp exactly, including the `T` between date and time and the `Z` at the end. ## Next - [Work with a long table in R](https://idss-mesa.github.io/trainings/tutorials/r-work-with-a-long-table/), which uses the same file. - [Count records per day in R](https://idss-mesa.github.io/trainings/tutorials/r-count-records-per-day/) - The same task in Python: [Turn UTC timestamps into local days](https://idss-mesa.github.io/trainings/tutorials/local-days-from-utc/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-work-with-a-long-table/ --- type: Guide title: "Work with a long table in R" description: "Summarise a long table, with one row per time and per kind of measurement, by measurement in R, and reshape it to one column for each kind with reshape()." tags: [byte, p2, rstudio, r, reshape, long-format] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/stats/html/reshape.html" title: "Reshape Grouped Data: reshape (R documentation)" author: "team:r-core" --- # Work with a long table in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-16 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Many archives store data *long*: one row per time and per kind of measurement, with the number in a single `value` column. It is a tidy way to store data and an easy way to average rainfall with temperature by accident. **You will:** have the hourly observations summarised by measurement and reshaped to one column for each. **Time:** 5 to 10 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. In the **Console**, fetch the hourly observations into your practice folder: ```r download.file("https://idss-mesa.github.io/trainings/assets/practice/observations.csv", "observations.csv") ``` You should see: a line that reads `downloaded 13 KB`. 2. Read the file and check its size: ```r obs <- read.csv("observations.csv") dim(obs) ``` You should see: ```text [1] 336 4 ``` 3. Look at the first rows: ```r head(obs, 5) ``` You should see: each timestamp twice, once for each kind of measurement. ```text gauge_id timestamp_utc measurement value 1 G03 2026-07-10T06:00:00Z rain_mm 0.0 2 G03 2026-07-10T06:00:00Z air_temp_c 13.8 3 G03 2026-07-10T07:00:00Z rain_mm 0.0 4 G03 2026-07-10T07:00:00Z air_temp_c 12.3 5 G03 2026-07-10T08:00:00Z rain_mm 0.0 ``` 4. Count the rows for each kind: ```r table(obs$measurement) ``` You should see: ```text air_temp_c rain_mm 168 168 ``` 5. Summarise each kind on its own: ```r aggregate(value ~ measurement, data = obs, FUN = function(v) round(c(min = min(v), max = max(v), mean = mean(v)), 2)) ``` You should see: two rows with nothing in common. `mean(obs$value)` would have returned 9.27, a number that is neither millimetres nor degrees. ```text measurement value.min value.max value.mean 1 air_temp_c 10.20 25.40 18.03 2 rain_mm 0.00 15.80 0.51 ``` 6. Reshape to one column per measurement, and check the size: ```r wide <- reshape(obs[c("timestamp_utc", "measurement", "value")], idvar = "timestamp_utc", timevar = "measurement", direction = "wide") head(wide, 3) dim(wide) ``` You should see: one row for each hour, with the timestamp and a column for each kind of measurement. ```text timestamp_utc value.rain_mm value.air_temp_c 1 2026-07-10T06:00:00Z 0 13.8 3 2026-07-10T07:00:00Z 0 12.3 5 2026-07-10T08:00:00Z 0 10.7 [1] 168 3 ``` ## Check it worked The counts reconcile: 168 hours × 2 measurements is 336, the number of rows you started with, and `wide` has no empty cells (`sum(is.na(wide))` is 0). ## If it didn't **`Warning message: ... multiple rows match for measurement=...: first taken`.** Some timestamp has two rows for the same measurement. R kept the first and dropped the other, and only warned. Find them with `obs[duplicated(obs[c("timestamp_utc", "measurement")]) | duplicated(obs[c("timestamp_utc", "measurement")], fromLast = TRUE), ]` and settle which is right before you reshape. ## Next - [Turn UTC timestamps into local days in R](https://idss-mesa.github.io/trainings/tutorials/r-local-days-from-utc/), which uses the same file. - [Query a Parquet file with DuckDB from R](https://idss-mesa.github.io/trainings/tutorials/r-query-parquet-with-duckdb/) - The same task in Python: [Work with a long table, one row per kind of measurement](https://idss-mesa.github.io/trainings/tutorials/work-with-a-long-table/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/query-parquet-with-duckdb/ --- type: Guide title: "Query a Parquet file with DuckDB from a notebook" description: "Run SQL against a Parquet file from a notebook with DuckDB, without loading the file into memory first, and bring a result back as a pandas table." tags: [byte, p3, duckdb, parquet, sql] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: duckdb resource: "https://duckdb.org/docs/stable/data/parquet/overview" title: "Reading and writing Parquet files (DuckDB documentation)" author: "team:duckdb" --- # Query a Parquet file with DuckDB from a notebook !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-13 and produced the output shown. Step 2 was followed there again on 2026-11-16 by the AI assistant that drafted the page. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Parquet is the format large shared datasets are usually stored in: compressed, typed, and readable one column at a time. DuckDB runs SQL straight against such a file, so you can ask a question of data far too large to load. **You will:** have queried a Parquet file with SQL and turned a result into a pandas table. **Time:** 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run. ## Steps 1. Import DuckDB: ```python import duckdb duckdb.__version__ ``` You should see: a version number, such as `'2.0.0'`. 2. Make a Parquet file to practise on, from the CSV you already have: ```python duckdb.sql("COPY (SELECT * FROM 'readings.csv') TO 'readings.parquet' (FORMAT parquet)") ``` You should see: a small table that reads **Count** and `152`, the number of rows written, and `readings.parquet` in the file browser. 3. Ask what the file holds, without reading its rows: ```python duckdb.sql("DESCRIBE SELECT * FROM 'readings.parquet'") ``` You should see: the four columns, each with a type. `date` is a real date here, not text. In a notebook, DuckDB draws the result as a table, with each column's type under its name; the text below holds the same rows. ```text ┌─────────────┬─────────────┬─────────┬─────────┬─────────┬─────────┐ │ column_name │ column_type │ null │ key │ default │ extra │ │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ ├─────────────┼─────────────┼─────────┼─────────┼─────────┼─────────┤ │ gauge_id │ VARCHAR │ YES │ NULL │ NULL │ NULL │ │ date │ DATE │ YES │ NULL │ NULL │ NULL │ │ value │ DOUBLE │ YES │ NULL │ NULL │ NULL │ │ flag │ VARCHAR │ YES │ NULL │ NULL │ NULL │ └─────────────┴─────────────┴─────────┴─────────┴─────────┴─────────┘ ``` 4. Summarise it with SQL: ```python duckdb.sql(""" SELECT gauge_id, count(*) AS n_rows, max(value) AS largest FROM 'readings.parquet' GROUP BY gauge_id ORDER BY gauge_id """) ``` You should see: ```text ┌──────────┬────────┬─────────┐ │ gauge_id │ n_rows │ largest │ │ varchar │ int64 │ double │ ├──────────┼────────┼─────────┤ │ G01 │ 27 │ 24.9 │ │ G02 │ 31 │ 2.92 │ │ G03 │ 32 │ 32.5 │ │ G04 │ 31 │ 26.4 │ │ G05 │ 31 │ 180.0 │ └──────────┴────────┴─────────┘ ``` 5. Bring a result into pandas with `.df()`: ```python flagged = duckdb.sql("SELECT * FROM 'readings.parquet' WHERE flag = 'S'").df() flagged ``` You should see: an ordinary pandas table with two rows. ```text gauge_id date value flag 0 G03 2026-07-18 0.0 S 1 G05 2026-07-09 180.0 S ``` ## Check it worked The `n_rows` column adds up to 152, the number of rows pandas counted in `readings.csv`. Two tools reading the same data should agree before you trust either. ## If it didn't **`IOException: IO Error: No files found that match the pattern "readings.parquet"`.** DuckDB looks in the notebook's own folder. Either step 2 did not run, or the notebook is not in `mesa-practice`. Run step 2 again and look for the file in the file browser. ## Next - The same SQL runs from a terminal with the `duckdb` command: `duckdb :memory: "SELECT count(*) FROM 'readings.parquet'"`. MESA JupyterLab does not include DuckDB's R package; for R, see [Query a Parquet file with DuckDB from R](https://idss-mesa.github.io/trainings/tutorials/r-query-parquet-with-duckdb/). - [Reconcile row counts before and after a join](https://idss-mesa.github.io/trainings/tutorials/reconcile-a-join/) - Reference: [Reading and writing Parquet files](https://duckdb.org/docs/stable/data/parquet/overview) and the [client overview](https://duckdb.org/docs/2.0/clients/overview) in the DuckDB documentation. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13; the code was run there on 2026-11-13 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/reconcile-a-join/ --- type: Guide title: "Reconcile row counts before and after a join" description: "Join a table of readings to a table of gauges and confirm that the join neither added nor lost rows and left no reading without a match." tags: [byte, p3, join, data-quality, pandas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-12T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.merge.html" title: "pandas.DataFrame.merge" author: "team:pandas-dev" --- # Reconcile row counts before and after a join !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-13 and produced the output shown. Nobody has yet followed the steps there by hand, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A join can silently add rows, when a key repeats in the table you look things up in, or lose them, when a key has no match. Counting rows before and after catches both. **You will:** have each reading joined to its gauge's name and unit, with row counts that prove the join changed nothing else. **Time:** 5 to 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run so that `readings` and `gauges` exist. ## Steps 1. Record the size of the table you are starting from: ```python len(readings) ``` You should see: `152`. 2. Confirm that the lookup table has one row for each key: ```python gauges["gauge_id"].is_unique ``` You should see: `True`. If a gauge appeared twice, every one of its readings would be doubled by the join. 3. Join, and have pandas enforce what you just checked: ```python joined = readings.merge(gauges, on="gauge_id", how="left", validate="many_to_one") ``` You should see: no output and no error. `how="left"` keeps every reading, whether or not it finds a gauge. 4. Compare the sizes: ```python len(readings), len(joined) ``` You should see: ```text (152, 152) ``` 5. Count the readings that found no gauge: ```python joined["name"].isna().sum() ``` You should see: `0`. Depending on the pandas version, it may be wrapped as `np.int64(0)`. 6. Look at the result: ```python joined.head(3) ``` You should see: the four original columns, then the gauge's columns. ```text gauge_id date value flag name unit elevation_m 0 G01 2026-07-01 0.0 NaN Boathouse mm 512 1 G01 2026-07-02 0.0 NaN Boathouse mm 512 2 G01 2026-07-03 24.9 NaN Boathouse mm 512 ``` ## Check it worked Three numbers agree: 152 rows before, 152 rows after, and 0 readings without a match. Each reading now carries its `unit`, which you need before values from different gauges can be compared. ## If it didn't **`MergeError: Merge keys are not unique in right dataset; not a many-to-one merge`.** The lookup table has a repeated `gauge_id`, and `validate` stopped the join before it could multiply rows. Find the repeats with `gauges[gauges["gauge_id"].duplicated(keep=False)]` and settle which row is right before you join. ## Next - [Leave a notebook someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/leave-a-rerunnable-notebook/) - A join carries problems along with it: rows repeated in `readings` are still repeated in `joined`. See [Count records per day to find incomplete days](https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/). - Reference: [pandas.DataFrame.merge](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.merge.html). *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-12; the code was run there on 2026-11-13 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/keep-secrets-out-of-files/ --- type: Guide title: "Keep tokens and passwords out of saved files" description: "Give a notebook a token without typing it into a cell, and confirm that the saved notebook does not contain it." tags: [byte, p3, credentials, jupyterlab, notebook] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-12T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/credentials/" title: "Credentials" author: "team:idss-mesa" - id: python resource: "https://docs.python.org/3/library/getpass.html" title: "getpass (Python standard library)" author: "team:python" --- # Keep tokens and passwords out of saved files !!! warning "Draft: not yet validated" These steps were followed once inside MESA JupyterLab on 2026-11-16, by the AI assistant that drafted them, with the notebook saved by its keyboard shortcut. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A notebook file stores every cell and every output. A token typed into a cell, or printed by one, is saved with the notebook and goes wherever the notebook goes: your Data Store, a shared folder, a Git repository. **You will:** have used a token in a notebook that does not contain it. **Time:** 5 to 10 minutes. **You need:** `practice.ipynb` from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/). You will use a made-up token, not a real one. ## Steps 1. In a new cell, run: ```python from getpass import getpass token = getpass("Token: ") ``` You should see: a box labelled **Token:** under the cell. 2. Type `not-a-real-token` into the box and press ++enter++. You should see: a dot for each character as you type, then a short row of dots beside **Token:**. The dots are a placeholder, not your token. The value is in memory as `token`; it is not in the cell and not in the output. 3. Confirm the notebook received it, without displaying it: ```python len(token) ``` You should see: `16`. 4. Choose **File → Save Notebook**. You should see: the dot on the notebook's tab disappear. 5. Count how many times the token appears in the saved file: ```python open("practice.ipynb").read().count(token) ``` You should see: `0`. 6. Remove it from memory when you have finished: ```python del token ``` You should see: no output. Restarting the kernel does the same. ## Check it worked Step 5 returns `0`: the saved notebook does not contain the token, although the notebook used it. ## If it didn't **Step 5 returns `1` or more.** The token was typed into a cell or shown in an output, for example by running `token` or `print(token)`. Delete that cell, choose **Edit → Clear Outputs of All Cells**, save, and run step 5 again. If it had been a real token, clearing it would not be enough: replace the token with a new one at the service that issued it, because earlier copies of the file may still hold the old one. ## Next - The MESA sign-in commands follow the same rule: `cyverse-login` and `aiverde-setup` ask for your password or key and keep it outside your Data Store. See [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/). - Reference: [Credentials](https://idss-mesa.github.io/docs/credentials/) in the MESA documentation, which says where each MESA tool stores a password, and [getpass](https://docs.python.org/3/library/getpass.html). *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-12 and followed once there on 2026-11-16.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-query-parquet-with-duckdb/ --- type: Guide title: "Query a Parquet file with DuckDB from R" description: "Run SQL against a Parquet file from R with the duckdb package in MESA RStudio Geospatial, and get each result back as an ordinary data frame." tags: [byte, p3, rstudio, duckdb, parquet] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: duckdb resource: "https://duckdb.org/docs/2.0/clients/r" title: "R Client (DuckDB documentation)" author: "team:duckdb" --- # Query a Parquet file with DuckDB from R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-13 (R 4.6.2, duckdb 2.0.0), by the AI assistant that drafted it, and produced the output shown, one step at a time. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). DuckDB runs SQL straight against a Parquet file, so R can summarise data far too large to read into memory. MESA RStudio Geospatial has the R `duckdb` package installed. **You will:** have queried a Parquet file with SQL from R, and have the result as a data frame. **Time:** 10 minutes. **You need:** the practice files in your working folder, from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/). ## Steps 1. Load the package and open a connection: ```r library(duckdb) con <- dbConnect(duckdb()) ``` You should see: `Loading required package: DBI`, and then, on first use, the question `duckdb: create /home/rstudio/.duckdb? (Yes/no/cancel)`. Type `yes` and press ++enter++. That folder holds DuckDB's settings; it is on the app's own disk and is removed when the app stops. 2. Make a Parquet file to practise on, from the CSV you already have: ```r dbExecute(con, "COPY (SELECT * FROM 'readings.csv') TO 'readings.parquet' (FORMAT parquet)") ``` You should see: the number of rows written. ```text [1] 152 ``` 3. Ask what the file holds, without reading its rows: ```r dbGetQuery(con, "DESCRIBE SELECT * FROM 'readings.parquet'") ``` You should see: the four columns with their types. Unlike `read.csv()`, DuckDB recognised `date` as a date. ```text column_name column_type null key default extra 1 gauge_id VARCHAR YES 2 date DATE YES 3 value DOUBLE YES 4 flag VARCHAR YES ``` 4. Summarise it with SQL: ```r dbGetQuery(con, " SELECT gauge_id, count(*) AS n_rows, max(value) AS largest FROM 'readings.parquet' GROUP BY gauge_id ORDER BY gauge_id ") ``` You should see: ```text gauge_id n_rows largest 1 G01 27 24.90 2 G02 31 2.92 3 G03 32 32.50 4 G04 31 26.40 5 G05 31 180.00 ``` 5. Keep a result as a data frame: ```r flagged <- dbGetQuery(con, "SELECT * FROM 'readings.parquet' WHERE flag = 'S'") flagged ``` You should see: two rows, in an ordinary data frame you can pass to any R function. ```text gauge_id date value flag 1 G03 2026-07-18 0 S 2 G05 2026-07-09 180 S ``` 6. Close the connection when you have finished: ```r dbDisconnect(con, shutdown = TRUE) ``` You should see: no output. ## Check it worked The `n_rows` column adds up to 152, the number of rows `dim(readings)` reported when R read the CSV. Two tools reading the same data should agree before you trust either. ## If it didn't **`IO Error: No files found that match the pattern "readings.parquet"`.** DuckDB looks in R's working folder. Either step 2 did not run, or R is somewhere else: run `getwd()`, and `setwd()` to your `mesa-practice` folder. ## Next - The same task in Python: [Query a Parquet file with DuckDB from a notebook](https://idss-mesa.github.io/trainings/tutorials/query-parquet-with-duckdb/). - [Map point data with sf in MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/) - Reference: [R Client](https://duckdb.org/docs/2.0/clients/r) in the DuckDB documentation, which also covers `dplyr` through `dbplyr`. *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13; the code was run there that day (R 4.6.2, duckdb 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-reconcile-a-join/ --- type: Guide title: "Reconcile row counts before and after a join in R" description: "Join a data frame of readings to a data frame of gauges with merge() and confirm that the join neither added nor lost rows and left no reading without a match." tags: [byte, p3, rstudio, r, join, data-quality] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/base/html/merge.html" title: "Merge Two Data Frames: merge (R documentation)" author: "team:r-core" --- # Reconcile row counts before and after a join in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-16 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown, one step at a time. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A join can silently add rows, when a key repeats in the table you look things up in, or lose them, when a key has no match. Counting rows before and after catches both. **You will:** have each reading joined to its gauge's name and unit, with row counts that prove the join changed nothing else. **Time:** 5 to 10 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. Record the size of the table you are starting from: ```r nrow(readings) ``` You should see: ```text [1] 152 ``` 2. Confirm that the lookup table has one row for each key: ```r anyDuplicated(gauges$gauge_id) ``` You should see: `0`, meaning no gauge appears twice. Any other number is the position of the first repeat, and every reading of that gauge would be doubled by the join. ```text [1] 0 ``` 3. Join: ```r joined <- merge(readings, gauges, by = "gauge_id", all.x = TRUE) ``` You should see: no output and no error. `all.x = TRUE` keeps every reading, whether or not it finds a gauge. Without it, `merge()` drops the readings that have no match and says nothing. 4. Compare the sizes: ```r c(nrow(readings), nrow(joined)) ``` You should see: ```text [1] 152 152 ``` 5. Count the readings that found no gauge: ```r sum(is.na(joined$name)) ``` You should see: ```text [1] 0 ``` 6. Look at the result: ```r head(joined, 3) ``` You should see: the four original columns, then the gauge's columns. ```text gauge_id date value flag name unit elevation_m 1 G01 2026-07-01 0.0 Boathouse mm 512 2 G01 2026-07-02 0.0 Boathouse mm 512 3 G01 2026-07-03 24.9 Boathouse mm 512 ``` ## Check it worked Three numbers agree: 152 rows before, 152 rows after, and 0 readings without a match. Each reading now carries its `unit`, which you need before values from different gauges can be compared. ## If it didn't **The second number in step 4 is larger than the first.** The lookup table has a repeated `gauge_id`, and `merge()` multiplied rows without a warning. Find the repeats with `gauges[gauges$gauge_id %in% gauges$gauge_id[duplicated(gauges$gauge_id)], ]` and settle which row is right before you join. **The rows of `joined` are in a different order from `readings`.** `merge()` sorts its result by the key. Count and compare; do not rely on row positions. ## Next - [Leave an R script someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/r-leave-a-rerunnable-script/) - A join carries problems along with it: rows repeated in `readings` are still repeated in `joined`. See [Count records per day in R](https://idss-mesa.github.io/trainings/tutorials/r-count-records-per-day/). - The same task in Python: [Reconcile row counts before and after a join](https://idss-mesa.github.io/trainings/tutorials/reconcile-a-join/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/join-and-keep-unmatched/ --- type: Guide title: "Join two tables and keep the unmatched rows visible" description: "Join a table of gauges to a table of positions with DuckDB so that a gauge with no match stays in the result and is counted, instead of dropping out unseen." tags: [byte, p3, join, duckdb, sql] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: duckdb resource: "https://duckdb.org/docs/stable/sql/query_syntax/from" title: "FROM and JOIN clauses (DuckDB documentation)" author: "team:duckdb" --- # Join two tables and keep the unmatched rows visible !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-16 (pandas 3.1.1, DuckDB 2.0.0) by the site's output check, in a terminal there, and gave the values shown. No person has yet followed the steps, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). An ordinary join keeps only the rows that find a match. The rest leave without a message, and every count after the join is quietly smaller. A left join keeps them where you can see them. **You will:** have a join in which a gauge with no position is still listed, and a count of how many gauges matched. **Time:** 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run. ## Steps 1. Make a table of positions that is incomplete on purpose: only the gauges west of one line of longitude. ```python import duckdb duckdb.sql("CREATE OR REPLACE VIEW west AS SELECT * FROM 'gauge_sites.csv' WHERE longitude < -104.73") duckdb.sql("SELECT count(*) AS n FROM west") ``` You should see: four positions, for five gauges. In a notebook, DuckDB draws the result as a table, with each column's type under its name; the text below holds the same rows. ```text ┌───────┐ │ n │ │ int64 │ ├───────┤ │ 4 │ └───────┘ ``` 2. Join the gauges to those positions in the ordinary way: ```python duckdb.sql(""" SELECT g.gauge_id, g.name, w.longitude, w.latitude FROM 'gauges.csv' AS g JOIN west AS w ON g.gauge_id = w.gauge_id ORDER BY g.gauge_id """) ``` You should see: four rows and no warning. One gauge has gone, and nothing says so. ```text ┌──────────┬───────────┬───────────┬──────────┐ │ gauge_id │ name │ longitude │ latitude │ │ varchar │ varchar │ double │ double │ ├──────────┼───────────┼───────────┼──────────┤ │ G01 │ Boathouse │ -104.7612 │ 47.1034 │ │ G02 │ Orchard │ -104.7391 │ 47.1108 │ │ G04 │ Depot │ -104.7533 │ 47.1175 │ │ G05 │ Quarry │ -104.7306 │ 47.0962 │ └──────────┴───────────┴───────────┴──────────┘ ``` 3. Change `JOIN` to `LEFT JOIN`, which keeps every row of the table named first: ```python duckdb.sql(""" SELECT g.gauge_id, g.name, w.longitude, w.latitude FROM 'gauges.csv' AS g LEFT JOIN west AS w ON g.gauge_id = w.gauge_id ORDER BY g.gauge_id """) ``` You should see: five rows. The gauge without a position is there, with `NULL` where its position would be. ```text ┌──────────┬─────────────┬───────────┬──────────┐ │ gauge_id │ name │ longitude │ latitude │ │ varchar │ varchar │ double │ double │ ├──────────┼─────────────┼───────────┼──────────┤ │ G01 │ Boathouse │ -104.7612 │ 47.1034 │ │ G02 │ Orchard │ -104.7391 │ 47.1108 │ │ G03 │ Observatory │ NULL │ NULL │ │ G04 │ Depot │ -104.7533 │ 47.1175 │ │ G05 │ Quarry │ -104.7306 │ 47.0962 │ └──────────┴─────────────┴───────────┴──────────┘ ``` 4. Count the matches, so the answer does not depend on reading every row. `count(w.gauge_id)` counts only the rows where a position was found: ```python duckdb.sql(""" SELECT count(*) AS gauges, count(w.gauge_id) AS matched, count(*) - count(w.gauge_id) AS unmatched FROM 'gauges.csv' AS g LEFT JOIN west AS w ON g.gauge_id = w.gauge_id """) ``` You should see: ```text ┌────────┬─────────┬───────────┐ │ gauges │ matched │ unmatched │ │ int64 │ int64 │ int64 │ ├────────┼─────────┼───────────┤ │ 5 │ 4 │ 1 │ └────────┴─────────┴───────────┘ ``` 5. Run the same count against the complete file, `'gauge_sites.csv'`, in place of `west`: ```python duckdb.sql(""" SELECT count(*) AS gauges, count(s.gauge_id) AS matched, count(*) - count(s.gauge_id) AS unmatched FROM 'gauges.csv' AS g LEFT JOIN 'gauge_sites.csv' AS s ON g.gauge_id = s.gauge_id """) ``` You should see: every gauge matched. ```text ┌────────┬─────────┬───────────┐ │ gauges │ matched │ unmatched │ │ int64 │ int64 │ int64 │ ├────────┼─────────┼───────────┤ │ 5 │ 5 │ 0 │ └────────┴─────────┴───────────┘ ``` ## Check it worked In each count, `matched` plus `unmatched` equals `gauges`. You can say which gauge had no position in step 3, and that the complete file leaves none out. ## If it didn't **`Catalog Error: Table with name west does not exist!`** The kernel has restarted since step 1, and the view went with it. Run step 1 again, then repeat the step. ## Next - [Reconcile row counts before and after a join](https://idss-mesa.github.io/trainings/tutorials/reconcile-a-join/), the same care in pandas. - [Bring two units onto one scale before comparing](https://idss-mesa.github.io/trainings/tutorials/convert-units-before-comparing/) - Reference: [FROM and JOIN clauses](https://duckdb.org/docs/stable/sql/query_syntax/from) in the DuckDB documentation, and [MESA JupyterLab](https://idss-mesa.github.io/docs/apps/jupyterlab/) for what the app contains. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15; the code was run there on 2026-11-16 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/convert-units-before-comparing/ --- type: Guide title: "Bring two units onto one scale before comparing" description: "Convert readings that were recorded in different units to one unit, using the table that says which unit each gauge reports in, and confirm that every row was converted." tags: [byte, p3, units, join, pandas] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/reference/api/pandas.Series.map.html" title: "pandas.Series.map" author: "team:pandas-dev" --- # Bring two units onto one scale before comparing !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-16 (pandas 3.1.1, DuckDB 2.0.0) by the site's output check, in a terminal there, and gave the values shown. No person has yet followed the steps, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). The practice gauges do not all report in the same unit, and the unit is written in a different file from the readings. Until the values share a unit, no comparison between gauges means anything. **You will:** have a `value_mm` column that holds every reading in millimetres, and proof that no row was left unconverted. **Time:** 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run so that `readings` and `gauges` exist. ## Steps 1. List the units in use: ```python gauges["unit"].value_counts() ``` You should see: two units. ```text unit mm 4 cm 1 Name: count, dtype: int64 ``` 2. Write down, as a small table of your own, how each unit becomes millimetres: ```python to_mm = {"mm": 1, "cm": 10} ``` You should see: no output. A unit you have not listed here will show up in step 4. 3. Give each reading its gauge's unit, then convert: ```python joined = readings.merge(gauges[["gauge_id", "unit"]], on="gauge_id", how="left", validate="many_to_one") joined["value_mm"] = joined["value"] * joined["unit"].map(to_mm) joined[joined["gauge_id"] == "G02"].head(3) ``` You should see: the original `value` kept, and `value_mm` ten times larger for this gauge. ```text gauge_id date value flag unit value_mm 27 G02 2026-07-01 0.00 NaN cm 0.0 28 G02 2026-07-02 0.00 NaN cm 0.0 29 G02 2026-07-03 2.89 NaN cm 28.9 ``` 4. Count the readings that were not converted: ```python int(joined["value_mm"].isna().sum()) ``` You should see: `0`. A reading with no gauge, or with a unit missing from `to_mm`, would have an empty `value_mm` and be counted here. 5. Compare the largest reading at each gauge, before and after: ```python joined.groupby("gauge_id")[["value", "value_mm"]].max() ``` You should see: G02 no longer far below its neighbours. ```text value value_mm gauge_id G01 24.90 24.9 G02 2.92 29.2 G03 32.50 32.5 G04 26.40 26.4 G05 180.00 180.0 ``` ## Check it worked `joined` has the same number of rows as `readings`, step 4 gave `0`, and for the four gauges that already reported in millimetres `value_mm` equals `value`. ## If it didn't **Step 4 gives a number above 0.** Some gauge reports in a unit that `to_mm` does not list. Run `joined.loc[joined["value_mm"].isna(), "unit"].unique()` to see which, add it to `to_mm` in step 2, and run steps 3 and 4 again. ## Next - The values now share a unit, but a total would still count one row twice. See [Find and remove a repeated row](https://idss-mesa.github.io/trainings/tutorials/remove-a-repeated-row/). - [Read the data dictionary before the data](https://idss-mesa.github.io/trainings/tutorials/read-the-data-dictionary/), which is where the two units were first noticed. - Reference: [pandas.Series.map](https://pandas.pydata.org/docs/reference/api/pandas.Series.map.html), and [MESA JupyterLab](https://idss-mesa.github.io/docs/apps/jupyterlab/) for what the app contains. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15; the code was run there on 2026-11-16 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/remove-a-repeated-row/ --- type: Guide title: "Find and remove a repeated row" description: "Find rows that are written twice in a table, decide from what they contain whether one of them can go, remove it, and record what you removed." tags: [byte, p3, duplicates, data-quality, pandas] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.drop_duplicates.html" title: "pandas.DataFrame.drop_duplicates" author: "team:pandas-dev" --- # Find and remove a repeated row !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-16 (pandas 3.1.1, DuckDB 2.0.0) by the site's output check, in a terminal there, and gave the values shown. No person has yet followed the steps, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A row written twice adds its value to every total twice. Removing it is easy. The part that needs thought is deciding that the two rows really are one reading. **You will:** have a table with the repeated row removed, and a note of what you removed and why. **Time:** 5 to 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run so that `readings` exists. ## Steps 1. Show every row that has an exact copy, keeping both copies in view: ```python readings[readings.duplicated(keep=False)] ``` You should see: one pair. ```text gauge_id date value flag 62 G03 2026-07-05 22.5 NaN 63 G03 2026-07-05 22.5 NaN ``` 2. Decide what to keep. Read the pair: the gauge, the day, the value, and the flag are all the same, and the [data dictionary](https://idss-mesa.github.io/trainings/tutorials/practice-data/#data-dictionary) says one row is one reading from one gauge for one day. You should see: no difference between the two rows. They carry the same information, so one can go and nothing is lost. 3. Remove the copy, into a new table: ```python deduped = readings.drop_duplicates() len(readings) - len(deduped) ``` You should see: `1`, the number of rows removed. `readings` itself is unchanged, so the earlier cells of your notebook still give what they gave. 4. Check for the harder case, two rows for the same gauge and day that *disagree*: ```python int(deduped.duplicated(subset=["gauge_id", "date"]).sum()) ``` You should see: `0`. Anything above zero would be two different readings for one day. `drop_duplicates()` leaves those alone, and so should you until you know which is right. 5. See what the copy was doing to that gauge's total: ```python before = readings.loc[readings["gauge_id"] == "G03", "value"].sum() after = deduped.loc[deduped["gauge_id"] == "G03", "value"].sum() (float(before.round(1)), float(after.round(1))) ``` You should see: the total fall by the value of the repeated row. ```text (273.6, 251.1) ``` 6. In a Markdown cell, record what you removed: the gauge, the day, the value, and that the two rows were identical. You should see: your note in the notebook, so that a reader can tell the row was removed on purpose. ## Check it worked Run step 1 on the new table, `deduped[deduped.duplicated(keep=False)]`. It returns no rows, and your note says which row went. ## If it didn't **Step 1 returns no rows.** The table was already cleaned earlier in the notebook, or `readings` was replaced by another table. Run the notebook's first cell again to reload the file, then repeat the step. ## Next - [Count records per day to find incomplete days](https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/), which finds the same row another way, and the days with no row at all. - [Bring two units onto one scale before comparing](https://idss-mesa.github.io/trainings/tutorials/convert-units-before-comparing/) - Reference: [pandas.DataFrame.drop_duplicates](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.drop_duplicates.html), and [MESA JupyterLab](https://idss-mesa.github.io/docs/apps/jupyterlab/) for what the app contains. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15; the code was run there on 2026-11-16 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/save-a-query/ --- type: Guide title: "Save a query so someone else can run it" description: "Put a SQL query in its own file beside the notebook, with a comment that says what it needs, and run it from that file so that a colleague runs exactly what you ran." tags: [byte, p3, sql, duckdb, reproducibility] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: duckdb resource: "https://duckdb.org/docs/stable/clients/python/overview" title: "Python API overview (DuckDB documentation)" author: "team:duckdb" --- # Save a query so someone else can run it !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-16 (pandas 3.1.1, DuckDB 2.0.0) by the site's output check, in a terminal there, and gave the values shown. The steps were also followed once in a notebook there by the AI assistant that drafted them. No person has yet followed the steps, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A query typed into a notebook cell is easy to change and hard to hand over. In a file of its own it has a name, it can be read without opening the notebook, and whoever runs it runs the same text you did. **You will:** have a file, `flagged_readings.sql`, beside your notebook, and a cell that runs the query from that file. **Time:** 5 to 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run. ## Steps 1. Write the query as text. Start it with comment lines, which begin with `--`, that say what it returns and which file it reads: ```python query = """-- Readings the sensor marked suspect, oldest first. -- Needs readings.csv in the folder this is run from. SELECT gauge_id, date, value FROM 'readings.csv' WHERE flag = 'S' ORDER BY date; """ ``` You should see: no output. 2. Save the text to a file beside the notebook: ```python from pathlib import Path saved = Path("flagged_readings.sql").write_text(query) ``` You should see: no output, and `flagged_readings.sql` in the file browser. 3. Run the query from the file, not from the variable: ```python import duckdb duckdb.sql(Path("flagged_readings.sql").read_text()) ``` You should see: the two flagged readings. In a notebook, DuckDB draws the result as a table, with each column's type under its name; the text below holds the same rows. ```text ┌──────────┬────────────┬────────┐ │ gauge_id │ date │ value │ │ varchar │ date │ double │ ├──────────┼────────────┼────────┤ │ G05 │ 2026-07-09 │ 180.0 │ │ G03 │ 2026-07-18 │ 0.0 │ └──────────┴────────────┴────────┘ ``` 4. Double-click `flagged_readings.sql` in the file browser. You should see: the query in an editor tab, with your two comment lines at the top. This is what a colleague reads first. 5. From now on, change the query in the file, save it, and run the cell from step 3 again. Delete the cells from steps 1 and 2 once the file exists, so that the notebook holds one copy of the query and not two. You should see: the cell from step 3 still giving the same two rows. ## Check it worked The folder holds `flagged_readings.sql`, and the one cell that reads it returns two rows. Someone with the folder can run that cell, or read the file, without asking you what the query was. ## If it didn't **`IO Error: No files found that match the pattern "readings.csv"`.** The query names its data file without a folder, so it must be run from the folder that holds the file. Open the notebook from `mesa-practice`, where `readings.csv` is, and run the cell again. ## Next - [Leave a notebook someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/leave-a-rerunnable-notebook/) - [Query a Parquet file with DuckDB from a notebook](https://idss-mesa.github.io/trainings/tutorials/query-parquet-with-duckdb/) - Reference: the [Python API overview](https://duckdb.org/docs/stable/clients/python/overview) in the DuckDB documentation, and [MESA JupyterLab](https://idss-mesa.github.io/docs/apps/jupyterlab/) for what the app contains. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15; followed once there on 2026-11-16 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-join-and-keep-unmatched/ --- type: Guide title: "Join two tables in R and keep the unmatched rows visible" description: "Join a table of gauges to an incomplete table of positions with merge() in R, keep the gauge that finds no match, and count how many matched." tags: [byte, p3, rstudio, r, join, data-quality] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/base/html/merge.html" title: "Merge Two Data Frames: merge (R documentation)" author: "team:r-core" --- # Join two tables in R and keep the unmatched rows visible !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-16 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). `merge()` keeps only the rows that find a match. The rest leave without a message, and every count after the join is quietly smaller. `all.x = TRUE` keeps them where you can see them. **You will:** have a join in which a gauge with no position is still listed, and a count of how many gauges matched. **Time:** 10 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. In the **Console**, fetch the file of gauge positions into your practice folder: ```r download.file("https://idss-mesa.github.io/trainings/assets/practice/gauge_sites.csv", "gauge_sites.csv") ``` You should see: a line that reads `downloaded 144 bytes`. 2. Read it, and make a copy that is incomplete on purpose: only the gauges west of one line of longitude. ```r sites <- read.csv("gauge_sites.csv") west <- sites[sites$longitude < -104.73, ] nrow(west) ``` You should see: four positions, for five gauges. ```text [1] 4 ``` 3. Join the gauges to those positions in the ordinary way: ```r merge(gauges[c("gauge_id", "name")], west[c("gauge_id", "longitude", "latitude")], by = "gauge_id") ``` You should see: four rows and no warning. One gauge has gone, and nothing says so. ```text gauge_id name longitude latitude 1 G01 Boathouse -104.7612 47.1034 2 G02 Orchard -104.7391 47.1108 3 G04 Depot -104.7533 47.1175 4 G05 Quarry -104.7306 47.0962 ``` 4. Add `all.x = TRUE`, which keeps every row of the table named first: ```r kept <- merge(gauges[c("gauge_id", "name")], west[c("gauge_id", "longitude", "latitude")], by = "gauge_id", all.x = TRUE) kept ``` You should see: five rows. The gauge without a position is there, with `NA` where its position would be. ```text gauge_id name longitude latitude 1 G01 Boathouse -104.7612 47.1034 2 G02 Orchard -104.7391 47.1108 3 G03 Observatory NA NA 4 G04 Depot -104.7533 47.1175 5 G05 Quarry -104.7306 47.0962 ``` 5. Count the matches, so the answer does not depend on reading every row: ```r c(gauges = nrow(kept), matched = sum(!is.na(kept$longitude)), unmatched = sum(is.na(kept$longitude))) ``` You should see: ```text gauges matched unmatched 5 4 1 ``` 6. Run the same join and count against the complete table, `sites`: ```r full <- merge(gauges[c("gauge_id", "name")], sites[c("gauge_id", "longitude", "latitude")], by = "gauge_id", all.x = TRUE) c(gauges = nrow(full), matched = sum(!is.na(full$longitude)), unmatched = sum(is.na(full$longitude))) ``` You should see: every gauge matched. ```text gauges matched unmatched 5 5 0 ``` ## Check it worked In each count, `matched` plus `unmatched` equals `gauges`. You can say which gauge had no position in step 4, and that the complete table leaves none out. ## If it didn't **`cannot open file 'gauge_sites.csv': No such file or directory`.** Step 1 saved the file somewhere else, because R is not in your practice folder. Run `getwd()` to see where it is, go to the folder with `setwd()` as in [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), and repeat step 1. **`object 'west' not found`.** R has restarted since step 2. Run step 2 again. ## Next - [Reconcile row counts before and after a join in R](https://idss-mesa.github.io/trainings/tutorials/r-reconcile-a-join/) - [Bring two units onto one scale in R](https://idss-mesa.github.io/trainings/tutorials/r-convert-units-before-comparing/) - The same task in Python: [Join two tables and keep the unmatched rows visible](https://idss-mesa.github.io/trainings/tutorials/join-and-keep-unmatched/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-convert-units-before-comparing/ --- type: Guide title: "Bring two units onto one scale in R" description: "Give each reading its gauge's unit in R, convert every value to millimetres with a lookup you write yourself, and confirm that no row was left unconverted." tags: [byte, p3, rstudio, r, units, data-quality] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/base/html/Extract.html" title: "Extract or Replace Parts of an Object (R documentation)" author: "team:r-core" --- # Bring two units onto one scale in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-16 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). The practice gauges do not all report in the same unit, and the unit is written in a different file from the readings. Until the values share a unit, no comparison between gauges means anything. **You will:** have a `value_mm` column that holds every reading in millimetres, and proof that no row was left unconverted. **Time:** 10 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. List the units in use: ```r table(gauges$unit) ``` You should see: two units. ```text cm mm 1 4 ``` 2. Write down, as a small lookup of your own, how each unit becomes millimetres: ```r to_mm <- c(mm = 1, cm = 10) ``` You should see: no output. A unit you have not listed here will show up in step 4. 3. Give each reading its gauge's unit, then convert: ```r joined <- merge(readings, gauges[c("gauge_id", "unit")], by = "gauge_id", all.x = TRUE) joined$value_mm <- joined$value * unname(to_mm[joined$unit]) head(joined[joined$gauge_id == "G02", ], 3) ``` You should see: the original `value` kept, and `value_mm` ten times larger for this gauge. `to_mm[joined$unit]` looks up each row's unit by name. ```text gauge_id date value flag unit value_mm 28 G02 2026-07-01 0.00 cm 0.0 29 G02 2026-07-02 0.00 cm 0.0 30 G02 2026-07-03 2.89 cm 28.9 ``` 4. Count the readings that were not converted: ```r sum(is.na(joined$value_mm)) ``` You should see: `0`. A reading with no gauge, or with a unit missing from `to_mm`, would have `NA` for `value_mm` and be counted here. ```text [1] 0 ``` 5. Compare the largest reading at each gauge, before and after: ```r aggregate(cbind(value, value_mm) ~ gauge_id, data = joined, FUN = max) ``` You should see: G02 no longer far below its neighbours. ```text gauge_id value value_mm 1 G01 24.90 24.9 2 G02 2.92 29.2 3 G03 32.50 32.5 4 G04 26.40 26.4 5 G05 180.00 180.0 ``` ## Check it worked `nrow(joined) == nrow(readings)` is `TRUE`, step 4 gave `0`, and for the four gauges that already reported in millimetres `value_mm` equals `value`. ## If it didn't **Step 4 gives a number above 0.** Some gauge reports in a unit that `to_mm` does not list. Run `unique(joined$unit[is.na(joined$value_mm)])` to see which, add it to `to_mm` in step 2, and run steps 3 and 4 again. ## Next - The values now share a unit, but a total would still count one row twice. See [Find and remove a repeated row in R](https://idss-mesa.github.io/trainings/tutorials/r-remove-a-repeated-row/). - [Reconcile row counts before and after a join in R](https://idss-mesa.github.io/trainings/tutorials/r-reconcile-a-join/) - The same task in Python: [Bring two units onto one scale before comparing](https://idss-mesa.github.io/trainings/tutorials/convert-units-before-comparing/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-remove-a-repeated-row/ --- type: Guide title: "Find and remove a repeated row in R" description: "Show the rows of an R data frame that have an exact copy, decide that they are one reading, remove the copy with unique(), and record what you removed." tags: [byte, p3, rstudio, r, duplicates, data-quality] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/base/html/duplicated.html" title: "Determine Duplicate Elements: duplicated (R documentation)" author: "team:r-core" --- # Find and remove a repeated row in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-16 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A row written twice adds its value to every total twice. Removing it is easy. The part that needs thought is deciding that the two rows really are one reading. **You will:** have a table with the repeated row removed, and a note of what you removed and why. **Time:** 5 to 10 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. Show every row that has an exact copy, keeping both copies in view: ```r readings[duplicated(readings) | duplicated(readings, fromLast = TRUE), ] ``` You should see: one pair. `duplicated()` alone marks only the second of a pair; `fromLast = TRUE` marks the first. ```text gauge_id date value flag 63 G03 2026-07-05 22.5 64 G03 2026-07-05 22.5 ``` 2. Decide what to keep. Read the pair: the gauge, the day, the value, and the flag are all the same, and the [data dictionary](https://idss-mesa.github.io/trainings/tutorials/practice-data/#data-dictionary) says one row is one reading from one gauge for one day. You should see: no difference between the two rows. They carry the same information, so one can go and nothing is lost. 3. Remove the copy, into a new table: ```r deduped <- unique(readings) nrow(readings) - nrow(deduped) ``` You should see: the number of rows removed. `readings` itself is unchanged. ```text [1] 1 ``` 4. Check for the harder case, two rows for the same gauge and day that *disagree*: ```r sum(duplicated(deduped[c("gauge_id", "date")])) ``` You should see: `0`. Anything above zero would be two different readings for one day. `unique()` leaves those alone, and so should you until you know which is right. ```text [1] 0 ``` 5. See what the copy was doing to that gauge's total: ```r c(before = sum(readings$value[readings$gauge_id == "G03"]), after = sum(deduped$value[deduped$gauge_id == "G03"])) ``` You should see: the total fall by the value of the repeated row. ```text before after 273.6 251.1 ``` 6. In a script or a notes file, record what you removed: the gauge, the day, the value, and that the two rows were identical. You should see: your note where a reader can tell the row was removed on purpose. ## Check it worked Run step 1 on the new table, with `deduped` in place of `readings`. It prints `<0 rows>`, and your note says which row went. ## If it didn't **Step 1 prints `<0 rows>`.** The table was already cleaned, or `readings` was replaced by another table. Read the file again, as in [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), then repeat the step. ## Next - [Count records per day in R](https://idss-mesa.github.io/trainings/tutorials/r-count-records-per-day/), which finds the same row another way, and the days with no row at all. - [Bring two units onto one scale in R](https://idss-mesa.github.io/trainings/tutorials/r-convert-units-before-comparing/) - The same task in Python: [Find and remove a repeated row](https://idss-mesa.github.io/trainings/tutorials/remove-a-repeated-row/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-save-a-query/ --- type: Guide title: "Save a query from R so someone else can run it" description: "Write a SQL query to a file of its own from R, then run it from that file with the duckdb package in MESA RStudio Geospatial, so that a colleague runs the same text you did." tags: [byte, p3, rstudio, r, duckdb, sql] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: duckdb resource: "https://duckdb.org/docs/stable/clients/r" title: "DuckDB R client" author: "org:duckdb" --- # Save a query from R so someone else can run it !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-16 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A query typed into the Console is easy to change and hard to hand over. In a file of its own it has a name, it can be read without opening R, and whoever runs it runs the same text you did. **You will:** have a file, `flagged_readings.sql`, in your practice folder, and one line of R that runs the query from that file. **Time:** 5 to 10 minutes. **You need:** the `mesa-practice` folder from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/), with R's working folder still set to it. ## Steps 1. Write the query as lines of text. Start with comment lines, which begin with `--`, that say what it returns and which file it reads: ```r query <- c( "-- Readings the sensor marked suspect, oldest first.", "-- Needs readings.csv in the folder this is run from.", "SELECT gauge_id, date, value", "FROM 'readings.csv'", "WHERE flag = 'S'", "ORDER BY date;" ) ``` You should see: no output. 2. Save the lines to a file in the working folder: ```r writeLines(query, "flagged_readings.sql") ``` You should see: no output. 3. Load DuckDB and open a connection: ```r library(duckdb) con <- dbConnect(duckdb()) ``` You should see: `Loading required package: DBI`, and then, on first use, the question `duckdb: create /home/rstudio/.duckdb? (Yes/no/cancel)`. Type `yes` and press ++enter++ before you type anything else. 4. Run the query from the file, not from the variable: ```r dbGetQuery(con, paste(readLines("flagged_readings.sql"), collapse = "\n")) ``` You should see: the two flagged readings. ```text gauge_id date value 1 G05 2026-07-09 180 2 G03 2026-07-18 0 ``` 5. In the **Console**, run `file.edit("flagged_readings.sql")`. You should see: the query in an editor tab above the Console, with your two comment lines at the top. This is what a colleague reads first. From now on, change the query here, save it, and run step 4 again. 6. Close the connection: ```r dbDisconnect(con, shutdown = TRUE) ``` You should see: no output. ## Check it worked `list.files()` names `flagged_readings.sql`, and the one line in step 4 returns two rows. Someone with the folder can run that line, or read the file, without asking you what the query was. ## If it didn't **`IO Error: No files found that match the pattern "readings.csv"`.** The query names its data file without a folder, so it must be run from the folder that holds the file. Go to your practice folder with `setwd()`, as in [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), and run step 4 again. **`Unrecognized response`, after step 3.** You typed the next command while DuckDB was still waiting for `yes`. Run step 3 again, answer `yes`, then go on. ## Next - [Leave an R script someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/r-leave-a-rerunnable-script/) - [Query a Parquet file with DuckDB from R](https://idss-mesa.github.io/trainings/tutorials/r-query-parquet-with-duckdb/) - The same task in Python: [Save a query so someone else can run it](https://idss-mesa.github.io/trainings/tutorials/save-a-query/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/ --- type: Guide title: "Sign in and start an AI agent in a MESA app" description: "Sign in to CyVerse from a terminal in a MESA app, connect an AI agent to a language model, and have it list the folders in your Data Store." tags: [byte, p4, ai-agents, jupyterlab, cyverse] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-18T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" - id: unblock resource: "https://unblockme.cyverse.org/" title: "CyVerse - Unblock Me" author: "team:cyverse" --- # Sign in and start an AI agent in a MESA app !!! warning "Draft: not yet validated" The AI assistant that drafted this tutorial ran all six steps in MESA JupyterLab on 2026-11-18 (OpenCode 1.19.4), with the account's owner typing the password and the key. Nobody has yet followed it as a reader would, from start to finish. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Every MESA app comes with AI coding agents that run in a terminal and can work with your Data Store through the MESA tools. They need two things from you: who you are, and a language model to think with. **You will:** have an agent that answers a question about your own Data Store. **Time:** 10 minutes. **You need:** [MESA JupyterLab running](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), and an API key for [CyVerse AI Verde](https://aiverde-docs.cyverse.ai/), which you get at under **Course → API Key**. ## Steps 1. In JupyterLab's **Launcher**, click **Terminal**. You should see: a terminal tab with a prompt. 2. Sign in to CyVerse: ```bash cyverse-login ``` It shows your username: press Enter to accept it. Then type your CyVerse password. You should see: `Verifying against /iplant/home/` and your username, then `Authenticated as` and your username. The agents now act as you, with access to your own files. Without this step they can read public data only. 3. Connect the language model: ```bash aiverde-setup ``` Paste your AI Verde key when it asks. You should see: `Available models:` and a list, then `Saved to` and a file name. The key is saved but this terminal has not loaded it yet. Load it: ```bash source ~/.config/aiverde/env ``` You should see: the prompt return with no message. 4. Start an agent: ```bash opencode ``` You should see: the OpenCode screen, with a box to type in and the model's name under it. A note that `formation` needs authentication is expected; this task does not use it. 5. Ask it: ```text List the folders in my CyVerse home. ``` You should see: the tools it calls, such as `mesa_ds_list_directory`, then a list of folder names. 6. In the portal's browser tab, click **Data Browser**, then **My Files**. You should see: the same folder names the agent listed. ## Check it worked The folders the agent lists are the ones in **My Files**. An agent that had not signed in as you could not see them. ## If it didn't **The agent lists only public folders, or says permission was denied.** It was started before you signed in, so its tools are still anonymous. Quit the agent, run `cyverse-login` again if you skipped it, and start the agent again. **`Authentication Error, No api key passed in.`** The key is saved but not loaded. Type `/exit`, run the `source` line in step 3, and start `opencode` again. **`cyverse-login` stays on `Verifying`, or says `the login test failed`.** The Data Store did not answer, which is not always a wrong password, and you are signed out again. Do not keep retrying: CyVerse blocks addresses that look like crawlers. Wait a few minutes, check , and sign in once more. lifts a block on your own computer; it is not yet known whether it helps for an app. ## Next - [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/) - Type your password and your key only where these commands ask for them. See [Keep tokens and passwords out of saved files](https://idss-mesa.github.io/trainings/tutorials/keep-secrets-out-of-files/). - Signing in lasts only as long as the app: repeat steps 2 and 3 in each new session. - Reference: [AI agents in the MESA apps](https://idss-mesa.github.io/docs/apps/agents/), for the other agents (`claude`, `codex`, `agy`), using your own account with an agent's vendor, and local models on a GPU. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-12 from the MESA documentation; all six steps were run in MESA JupyterLab on 2026-11-18.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/see-an-agents-tools/ --- type: Guide title: "See which tool servers your agent can use" description: "List the tool servers an AI agent has in a MESA app, read which are connected and which need a sign-in, and say what the agent can and cannot reach." tags: [byte, p4, ai-agents, mcp, jupyterlab] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-19T00:00:00Z" } stale_after: "2027-05-19T00:00:00Z" sources: - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" - id: docs-mesa-mcp resource: "https://idss-mesa.github.io/docs/servers/mesa-mcp/" title: "mesa-mcp" author: "team:idss-mesa" --- # See which tool servers your agent can use !!! warning "Draft: not yet validated" The AI assistant that drafted this tutorial ran steps 1 to 3 in MESA JupyterLab on 2026-11-19 (OpenCode 1.19.4), without signing in to CyVerse. Nobody has yet followed it as a reader would. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). An agent can only act through its tools, and tools come from servers. Before you trust an agent with a task, look at which servers it has and which of them are working. It takes one command and no language model. **You will:** know which tool servers your agent has, which are connected, and what each one reaches. **Time:** 5 minutes. **You need:** [MESA JupyterLab running](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/). You do not need a key or a sign-in for this task. ## Steps 1. In JupyterLab's **Launcher**, click **Terminal**. You should see: a welcome text with a line that starts `MCP` and names four servers: `irods · mesa · formation · filesystem`. 2. Ask the agent for its servers and their state: ```bash opencode mcp list ``` You should see: a list headed `MCP Servers` that ends `4 server(s)`: ```text ✓ irods connected https://mcp-public.cyverse.ai/mcp ✓ mesa connected /usr/local/bin/mesa-mcp ⚠ formation needs authentication https://de.cyverse.org/formation/mcp ✓ filesystem connected /home/jovyan/.npm-global/bin/mcp-server-filesystem /home/jovyan/work /home/jovyan/data-store ``` 3. Read each entry against this table. | Server | What its tools reach | What the second line tells you | |---|---|---| | `irods` | The Data Store | A web address: it runs outside your app | | `mesa` | The Data Store, plus metadata | A program: it runs inside your app | | `formation` | Apps and analyses | Not usable until you sign in to it | | `filesystem` | Files in the app | The two folders it may touch, and no others | You should see: three servers with `✓` and one with `⚠`. `connected` means the server answered. It does not mean it is signed in as you. 4. Write down one thing the agent cannot do as it stands. You should see: something like "it cannot launch an app, because `formation` is not signed in", or "it cannot read files outside `work` and `data-store`". ## Check it worked You can say, without starting the agent, which of these it could do: list a public folder in the Data Store (yes), read a file in `/home/jovyan/work` (yes), check on a running analysis (no). ## If it didn't **A server is missing, or does not show `connected`.** Stop the app and launch a new one; the servers are set up when the app starts. If it happens again, [report it](https://github.com/idss-mesa/trainings/issues) with the output of the command. **You use a different agent.** Each has its own command. `claude mcp list` was seen to work on 2026-11-18 and showed one more entry, `irods-auth`. The reference below has the others. ## Next - [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/): after `cyverse-login`, the Data Store tools act as you. This list stays the same: it was read again after signing in on 2026-11-19. - [How an agent reaches data: tools and MCP](https://idss-mesa.github.io/trainings/explainers/tools-and-mcp/) - This list names servers, not single tools. To see a tool's name, watch which one the agent calls when it works. - Reference: [AI agents in the MESA apps](https://idss-mesa.github.io/docs/apps/agents/) and [mesa-mcp](https://idss-mesa.github.io/docs/servers/mesa-mcp/). *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-19; steps 1 to 3 were run in MESA JupyterLab that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/check-what-an-agent-may-change/ --- type: Guide title: "Check what an agent may change before you let it" description: "Read an AI agent's permission rules in a MESA app, then test them in a scratch folder: what it writes without asking, what it is stopped from, and what a read-only agent does instead." tags: [byte, p4, ai-agents, permissions, verification] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-20T00:00:00Z" } stale_after: "2027-05-20T00:00:00Z" sources: - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" --- # Check what an agent may change before you let it !!! warning "Draft: not yet validated" The AI assistant that drafted this tutorial ran every command on this page in MESA JupyterLab on 2026-11-20 (OpenCode 1.19.4) and saw the results shown. It did not test what a shell command run by the agent may reach, or the question the OpenCode screen asks. Nobody has yet followed the page as a reader would. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). You may expect an agent to ask before it changes a file. In a MESA app, OpenCode's default agent does not: inside the folder where you start it, it writes at once. Find out where its limits are in a folder that holds nothing you care about. **You will:** know what your agent changes without asking, what stops it, and how to run it so that it changes nothing. **Time:** 10 minutes. **You need:** to have finished [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/) in this app session. If the agent is open, type `/exit` first. ## Steps 1. In the terminal, make a scratch folder and move into it: ```bash mkdir -p ~/work/agent-test && cd ~/work/agent-test ``` You should see: the prompt, now ending `agent-test`. 2. Read the first rule of the default agent, `build`: ```bash opencode agent list | head -7 ``` You should see: permission `*` with action `allow`. Everything is allowed unless a later rule says otherwise. The full list is long; the later rules for `build` ask only for paths outside the starting folder and for files ending `.env`. ```text build (primary) [ { "permission": "*", "action": "allow", "pattern": "*" }, ``` 3. Test it. Ask for a file in this folder: ```bash opencode run "Create a file named agent-note.txt in the current folder containing the single line: written by the agent. Then stop." ``` You should see: the file written, and no question asked. ```text ← Write agent-note.txt Wrote file successfully. ``` 4. Ask for a file outside the folder: ```bash opencode run "Create a file at /home/jovyan/outside-note.txt containing the single line: written by the agent. Use the write tool, not a shell command. Then stop." ``` You should see: the request stopped. Run this way, nobody is there to answer, so OpenCode refuses for you. ```text ! permission requested: external_directory (/home/jovyan/*); auto-rejecting ✗ Write /home/jovyan/outside-note.txt failed ``` 5. Ask the `plan` agent for a file here: ```bash opencode run --agent plan "Create a file named plan-note.txt in the current folder containing the single line: written by the agent. Then stop." ``` You should see: a few lines describing how it would make the file, and no `Write` line. 6. Look at what exists: ```bash ls ~/work/agent-test ~/outside-note.txt ``` You should see: `agent-note.txt` alone in the folder, and `No such file or directory` for the other. ## Check it worked You can finish each sentence. "Inside the folder I start it in, the agent …" (writes without asking). "Outside that folder, it …" (must ask, and is refused when nobody answers). "To get advice and no changes, I …" (add `--agent plan`). So choose the starting folder with care: start the agent in the smallest folder that holds the task, not in your home folder or your Data Store. ## If it didn't **Step 3 or 5 gives an error about a key or a model.** The key is not loaded in this terminal. Run the `source` line from step 3 of [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/) and try again. **Step 5 wrote the file.** Your rules differ from the ones seen here. Run `opencode agent list`, find `plan`, and look for a rule with permission `edit`. ## Next - Remove the scratch folder: `rm -r ~/work/agent-test`. - [When to stop and ask](https://idss-mesa.github.io/trainings/explainers/when-to-stop-and-ask/): which steps should wait for you, whatever the agent's rules allow. - [See which tool servers your agent can use](https://idss-mesa.github.io/trainings/tutorials/see-an-agents-tools/): these rules cover the agent's own tools. What a tool server may change in your Data Store is a separate question. - [Read back what an agent ran](https://idss-mesa.github.io/trainings/tutorials/read-what-an-agent-ran/) - Reference: [AI agents in the MESA apps](https://idss-mesa.github.io/docs/apps/agents/). *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-20; every command was run there that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/read-what-an-agent-ran/ --- type: Guide title: "Read back what an agent ran" description: "After an AI agent finishes in a MESA app, list its sessions, export one to a file, and print every tool it called with the inputs it gave." tags: [byte, p4, ai-agents, mcp, verification] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-19T00:00:00Z" } stale_after: "2027-05-19T00:00:00Z" sources: - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" --- # Read back what an agent ran !!! warning "Draft: not yet validated" The AI assistant that drafted this tutorial ran steps 1 to 3 in MESA JupyterLab on 2026-11-19 (OpenCode 1.19.4), on a session it started with one command rather than in the OpenCode screen. Nobody has yet followed the page as a reader would. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). While an agent works, its tool calls scroll past. Afterwards you may need to say exactly which tools it called and on what. OpenCode keeps each conversation as a session that you can write to a file. **You will:** have a file with one agent session in it, and a printed list of every tool call in that session. **Time:** 5 to 10 minutes. **You need:** to have finished [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/) in this app session. If the agent is still open, type `/exit` first. ## Steps 1. In the terminal, list the sessions: ```bash opencode session list ``` You should see: a table with the columns `Session ID`, `Title` and `Updated`, and one row for each conversation. An ID starts with `ses_`. The agent wrote the title itself. 2. Export the session to a file. Put your own ID in place of `ses_...`: ```bash opencode export ses_... > ~/work/agent-run.json ``` You should see: `Exporting session:` and the ID. The file `agent-run.json` is now in the `work` folder. 3. Print the tool calls. Paste all seven lines at once and press Enter: ```bash python3 - <<'PY' import json run = json.load(open("/home/jovyan/work/agent-run.json")) for message in run["messages"]: for part in message["parts"]: if part["type"] == "tool": print(part["tool"], part["state"]["status"], part["state"]["input"]) PY ``` You should see: one line for each call, in the order they were made. For the question in the earlier tutorial, the run that was checked printed: ```text mesa_ds_list_allowed_directories completed {} mesa_ds_list_directory completed {'path': '/iplant/home/gctest01'} ``` Your path has your own username, and your agent may have taken another route. 4. Read each line as three facts: the tool, whether it finished, and what it was given. You should see: no line you cannot account for. A tool whose name has `write`, `delete` or `move` in it would mean the agent changed something. ## Check it worked The printed lines match the calls you saw on screen while the agent worked, and every folder or file the agent's answer mentions appears in the input of some line. An answer that names something no call touched did not come from your data. ## If it didn't **The table in step 1 is empty.** Sessions do not outlive the app. Run the agent again in this app session, then list again. **Step 3 prints nothing.** The agent answered without calling a tool. That is worth knowing: see [How an agent reaches data: tools and MCP](https://idss-mesa.github.io/trainings/explainers/tools-and-mcp/). **`KeyError` in step 3.** The file's layout differs from OpenCode 1.19.4, which this page was written against. [Tell us](https://github.com/idss-mesa/trainings/issues). ## Next - [Keep a log of AI-assisted steps](https://idss-mesa.github.io/trainings/tutorials/keep-an-ai-log/): the printed lines are the evidence for a row's "What it answered". - The export holds everything the agent read, word for word. Treat it like the data itself before you share it. `opencode export --sanitize` replaces the text and the inputs with placeholders and keeps the tool names. - Files in `work` do not outlive the app. To keep this one, see [Save your work where it survives the session](https://idss-mesa.github.io/trainings/tutorials/save-your-work/). - Reference: [AI agents in the MESA apps](https://idss-mesa.github.io/docs/apps/agents/). *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-19 from the commands' own help text in the app; steps 1 to 3 were run in MESA JupyterLab that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/ask-for-a-query-then-run-it/ --- type: Guide title: "Ask an agent for a query, then run it yourself" description: "Have an AI agent draft a DuckDB query without running it, read the draft, save it to a file, run it yourself, and write down what the query leaves out." tags: [byte, p4, ai-agents, verification, duckdb] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-19T00:00:00Z" } stale_after: "2027-05-19T00:00:00Z" sources: - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" --- # Ask an agent for a query, then run it yourself !!! warning "Draft: not yet validated" The AI assistant that drafted this tutorial sent the request in step 1 twice in MESA JupyterLab on 2026-11-19 (OpenCode 1.19.4), with one command rather than in the OpenCode screen, and ran the code in steps 3 to 5 in a terminal there. Nobody has yet followed the page as a reader would. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). An agent that runs its own query hands you a number. An agent that only drafts the query hands you something you can read first. The run, and the result, are yours. **You will:** have the agent's query in a file beside your notebook, a result you ran yourself, and a note of what the query leaves out. **Time:** 10 minutes. **You need:** to have finished [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/) in this app session, and the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/) with its first cell run. ## Steps 1. In the OpenCode screen, ask for a draft and nothing more: ```text Write one DuckDB SQL query that reads the file readings.csv (columns: gauge_id, date, value, flag) and returns the total of value for each gauge_id. Do not run it and do not use any tools. Reply with the SQL only. ``` You should see: a query of a few lines and no tool calls. Yours may differ from the one below. 2. Before you run it, read it for three things: which file it reads, which rows it leaves out, and whether it changes anything. You should see, for the draft below: `readings.csv` in the folder it is run from; no rows left out, as there is no `WHERE`; and nothing changed, as it is a single `SELECT`. 3. In your notebook, paste the draft into a cell and save it to a file. Put first where it came from: ```python from pathlib import Path draft = """-- Drafted by an AI agent (OpenCode, gpt-oss-120b) on 2026-11-19. -- Not yet checked. SELECT gauge_id, SUM(value) AS total_value FROM read_csv_auto('readings.csv') GROUP BY gauge_id ORDER BY gauge_id; """ saved = Path("agent_total_by_gauge.sql").write_text(draft) ``` You should see: no output, and `agent_total_by_gauge.sql` in the file browser. 4. Run the query from the file: ```python import duckdb duckdb.sql(Path("agent_total_by_gauge.sql").read_text()) ``` You should see: one total for each gauge. The long decimals come from adding fractions; 390.8999999999999 is 390.9. ```text ┌──────────┬────────────────────┐ │ gauge_id │ total_value │ │ varchar │ double │ ├──────────┼────────────────────┤ │ G01 │ 190.29999999999998 │ │ G02 │ 21.830000000000002 │ │ G03 │ 273.59999999999997 │ │ G04 │ 198.80000000000004 │ │ G05 │ 390.8999999999999 │ └──────────┴────────────────────┘ ``` 5. Compare it with a total you compute another way: ```python readings.groupby("gauge_id")["value"].sum() ``` You should see: the same five totals. The query does what you asked. ```text gauge_id G01 190.30 G02 21.83 G03 273.60 G04 198.80 G05 390.90 Name: value, dtype: float64 ``` 6. In the file, replace `Not yet checked.` with what you found and what the query leaves out. You should see: something like "Run and matched against pandas on 2026-11-19. A plain sum: it includes the readings flagged `S`." ## Check it worked The folder holds `agent_total_by_gauge.sql`, whose first lines say who drafted it and what you checked. You can say why G05's 390.9 is not yet a rainfall total: you asked for a sum, the agent never saw the data, and so nothing in the draft knows about the flagged 180 mm reading. ## If it didn't **The agent ran the query, or called a tool.** Nothing is harmed. Ask again, keeping the sentence that begins "Do not run it". **`IO Error: No files found that match the pattern "readings.csv"`.** The draft names the file without a folder. Open the notebook from `mesa-practice` and run the cell again. ## Next - [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/) takes the 390.9 apart. - [Save a query so someone else can run it](https://idss-mesa.github.io/trainings/tutorials/save-a-query/) - [Read back what an agent ran](https://idss-mesa.github.io/trainings/tutorials/read-what-an-agent-ran/) confirms it called no tools. - Reference: [AI agents in the MESA apps](https://idss-mesa.github.io/docs/apps/agents/). *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-19; the request and the code were run there that day (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/ --- type: Guide title: "Check an AI-suggested result against the data" description: "Test a result that an AI assistant, or anyone else, hands you: reproduce the number, find what it rests on, and say whether the claim survives." tags: [byte, p4, verification, ai-agents, pandas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" --- # Check an AI-suggested result against the data !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-13 and produced the output shown. Nobody has yet followed the steps there by hand, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). An AI assistant answers fluently whether or not the answer is sound, and so does a hurried colleague. The check is the same for both, and it takes a few minutes. Suppose you asked an assistant about the practice data and it replied: > Quarry (G05) was the wettest gauge in July, with 390.9 mm of rain. **You will:** have decided, from the data, whether that claim stands. **Time:** 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run. You do not need an AI assistant for this tutorial. ## Steps 1. In a Markdown cell, write the claim down and what would make it wrong: a different total, or a total that depends on readings you would not trust. You should see: the claim in your notebook, where the check will sit beside it. 2. Reproduce the number: ```python readings.groupby("gauge_id")["value"].sum() ``` You should see: 390.9 for G05. The assistant did not invent the figure. ```text gauge_id G01 190.30 G02 21.83 G03 273.60 G04 198.80 G05 390.90 Name: value, dtype: float64 ``` 3. A number you can reproduce is not yet a number you can believe. Look at what it is made of: ```python readings[readings["gauge_id"] == "G05"].nlargest(3, "value") ``` You should see: one reading far larger than the rest, and flagged. ```text gauge_id date value flag 129 G05 2026-07-09 180.0 S 130 G05 2026-07-10 27.5 NaN 123 G05 2026-07-03 27.1 NaN ``` 4. Recompute without the readings the sensor marked suspect: ```python kept = readings[readings["flag"] != "S"] kept.groupby("gauge_id")["value"].sum() ``` You should see: G05 fall to 210.9, below G03. ```text gauge_id G01 190.30 G02 21.83 G03 273.60 G04 198.80 G05 210.90 Name: value, dtype: float64 ``` 5. Under the claim, write your verdict in one or two sentences: what you reproduced, what it depended on, and what you conclude. You should see: something like "The 390.9 mm is the plain sum, but 180 mm of it is one reading flagged as suspect. Without it Quarry is not the wettest gauge." ## Check it worked Your notebook holds the claim, the code that tests it, and a verdict a reader can check. You have not shown which gauge *was* wettest: these totals still mix units and include a repeated row and a gauge with missing days. ## If it didn't **Step 4 changes nothing.** The flag was compared with the wrong text, for example `"s"` or `"S "`. Run `readings["flag"].value_counts(dropna=False)` to see the exact values, and compare against one of those. ## Next - The other checks a fair comparison needs: [Read the data dictionary before the data](https://idss-mesa.github.io/trainings/tutorials/read-the-data-dictionary/) for units and [Count records per day to find incomplete days](https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/) for repeats and gaps. - To ask an assistant yourself: [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/). *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13; the code was run there on 2026-11-13 (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/keep-an-ai-log/ --- type: Guide title: "Keep a log of AI-assisted steps" description: "Keep a table in your notebook with one row for each step an AI assistant helped with: what you asked, what it answered, how you checked it, and what you decided." tags: [byte, p4, ai-agents, verification, disclosure] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" - id: jupyterlab resource: "https://jupyterlab.readthedocs.io/en/stable/user/notebook.html" title: "Notebooks (JupyterLab documentation)" author: "team:jupyterlab" --- # Keep a log of AI-assisted steps !!! warning "Draft: not yet validated" Nobody has yet followed this tutorial in MESA JupyterLab, so a key or a menu name may differ there. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). An answer from an AI assistant that went into your work unrecorded cannot be checked later, by you or by anyone else. A log made as you go costs a minute a row, and it is what lets you say afterwards exactly what the assistant did. **You will:** have an AI log in your notebook, with a first row filled in. **Time:** 5 to 10 minutes. **You need:** `practice.ipynb` from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/). You do not need an AI assistant: the first row uses the answer tested in [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/). ## Steps 1. Click the last cell of the notebook, press ++esc++, then ++b++ to add a cell below it, then ++m++ to make it a Markdown cell. You should see: an empty cell at the end, with no `[ ]:` beside it. 2. Type the heading and the top of the table: ```markdown ## AI log | # | Date | Tool and model | What I asked | What it answered | How I checked | Verdict | |---|---|---|---|---|---|---| ``` You should see: after ++shift+enter++, the heading and one row of column titles. 3. Double-click the cell to edit it again, and add one row under the table for the example answer: ```markdown | 1 | 2026-11-15 | (example from a tutorial; no tool) | Which gauge was wettest in July? | Quarry (G05), 390.9 mm | Recomputed the totals without flagged readings | Rejected: 180 mm of it is one reading flagged as suspect | ``` You should see: after ++shift+enter++, a table with one numbered row. 4. Read the row against these four rules, which hold for every row you add later: - **What I asked** is the prompt as you gave it, or its exact first sentence. - **What it answered** is the claim you used or refused, with its numbers. - **How I checked** names something you ran or read yourself. "Looked right" is not a check. - **Verdict** is one of *kept*, *changed*, or *rejected*, and why. You should see: that the example row passes all four. 5. Add a row each time an assistant helps, at the moment it happens, including the answers you rejected. Under **Tool and model**, write the command you started and the model it used, for example the agent's name and the model name it reports. You should see: one row for each assisted step, in the order they happened. 6. Choose **File → Save Notebook**. You should see: the log saved in the notebook, so that it goes wherever the notebook goes. ## Check it worked The notebook ends with an **AI log** table, and no row has an empty **How I checked** or **Verdict**. For any number in the notebook that came from an assistant, you can point to its row. ## If it didn't **The table shows as lines of text with `|` between the words.** The second line of the table, the one made of dashes, is missing or has a different number of columns from the first. Double-click the cell, make the two lines match, and press ++shift+enter++. ## Next - [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/), for the check behind the example row. - [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/) - Reference: [AI agents in the MESA apps](https://idss-mesa.github.io/docs/apps/agents/), for the agents each app includes and how each connects to a model. *Not yet validated in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15 from the MESA documentation and the JupyterLab documentation.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/plot-to-spot-odd-values/ --- type: Guide title: "Plot a column to spot odd values" description: "Draw one box per gauge for a column of readings, so that a value far from the rest, or a gauge on a different scale, shows up at a glance." tags: [byte, p4, exploration, plotting, pandas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/user_guide/visualization.html" title: "Chart visualization (pandas user guide)" author: "team:pandas-dev" --- # Plot a column to spot odd values !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-17, by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A table of 152 numbers hides what a picture shows in a second. This check suits any column of measurements, whoever or whatever produced it. **You will:** have found one reading and one gauge in `readings` that do not sit with the rest, from a chart. **Time:** 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run so that `readings` and `gauges` exist. ## Steps 1. Draw one box per gauge: ```python readings.boxplot(column="value", by="gauge_id") ``` You should see: a chart titled **Boxplot grouped by gauge_id**, with five boxes squashed below 35 and a single circle near 180 above **G05**. A line of text beginning ` 100] ``` You should see: ```text gauge_id date value flag 129 G05 2026-07-09 180.0 S ``` 3. One extreme value sets the scale for everything else. Draw the chart again without it, to look at the rest: ```python readings[readings["value"] < 100].boxplot(column="value", by="gauge_id") ``` You should see: the axis now ends near 35. Four gauges reach 25 to 33. The box for **G02** stays under 3. 4. A gauge ten times lower than its neighbours is either in a much drier place or on a different scale. Look at the gauge table: ```python gauges ``` You should see: `cm` in the `unit` column for G02, and `mm` for the others. ```text gauge_id name unit elevation_m 0 G01 Boathouse mm 512 1 G02 Orchard cm 540 2 G03 Observatory mm 688 3 G04 Depot mm 521 4 G05 Quarry mm 603 ``` 5. In a Markdown cell, write down the two things the chart showed and what you would do about each before computing with `value`. You should see: a note such as "G05 has one reading of 180 on 2026-07-09, flagged S. G02 is recorded in cm, the others in mm." ## Check it worked You can name the date of the odd reading and the gauge on a different scale, and you found both from the chart before you looked at any row. ## If it didn't **Only the ` 'S'") ``` You should see: `0`, not `150`. The two routes disagree, so at least one of them is not doing what you meant. In a notebook, DuckDB draws each result as a table; the text below holds the same rows. ```text ┌───────┐ │ n │ │ int64 │ ├───────┤ │ 0 │ └───────┘ ``` 3. Look at what the column holds: ```python duckdb.sql("SELECT flag, count(*) AS n FROM readings GROUP BY flag ORDER BY flag") ``` You should see: two rows flagged `S`, and 150 with no flag at all, which SQL calls `NULL`. ```text ┌─────────┬───────┐ │ flag │ n │ │ varchar │ int64 │ ├─────────┼───────┤ │ S │ 2 │ │ NULL │ 150 │ └─────────┴───────┘ ``` In SQL, comparing `NULL` with anything is neither true nor false, so `WHERE` drops those rows. pandas treats a blank as "not equal to S" and keeps them. 4. Say what you mean in SQL: keep every row whose flag is anything other than `S`, blanks included. ```python duckdb.sql("SELECT count(*) AS n FROM readings WHERE flag IS DISTINCT FROM 'S'") ``` You should see: `150`, the same as step 1. ```text ┌───────┐ │ n │ │ int64 │ ├───────┤ │ 150 │ └───────┘ ``` 5. With the counts in agreement, compare a result built on them: ```python duckdb.sql(""" SELECT gauge_id, round(sum(value), 2) AS total FROM readings WHERE flag IS DISTINCT FROM 'S' GROUP BY gauge_id ORDER BY gauge_id """) ``` You should see: the totals that `kept.groupby("gauge_id")["value"].sum()` gives in pandas. ```text ┌──────────┬────────┐ │ gauge_id │ total │ │ varchar │ double │ ├──────────┼────────┤ │ G01 │ 190.3 │ │ G02 │ 21.83 │ │ G03 │ 273.6 │ │ G04 │ 198.8 │ │ G05 │ 210.9 │ └──────────┴────────┘ ``` ## Check it worked Both routes count 150 readings and give 210.9 for G05, and you can say why the first SQL query counted none. ## If it didn't **Step 2 says the table `readings` does not exist.** The first cell of the notebook has not been run in this session. Run it, then try again. **The two routes agree but you doubt both.** Agreement shows the two were computed the same way, not that the data is sound. These totals still mix units. ## Next - [Check that the parts add up to the whole](https://idss-mesa.github.io/trainings/tutorials/check-parts-add-up/), a check that needs no second tool. - [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/) - Reference: [NULL values](https://duckdb.org/docs/stable/sql/data_types/nulls) in the DuckDB documentation. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17; the code was run there that day (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/check-parts-add-up/ --- type: Guide title: "Check that the parts add up to the whole" description: "After splitting a table into groups, add the groups back up and compare with the whole table, so that rows dropped without warning are noticed." tags: [byte, p4, verification, groupby, pandas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/user_guide/groupby.html" title: "Group by: split-apply-combine (pandas user guide)" author: "team:pandas-dev" --- # Check that the parts add up to the whole !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-17, by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Splitting a table into groups should lose nothing: the groups, added up, should give the table back. When they do not, rows have gone missing without an error message. **You will:** have caught 150 rows that a grouping dropped without warning, and confirmed a split that loses none. **Time:** 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run so that `readings` and `gauges` exist. ## Steps 1. State the whole before you split it: ```python len(readings) ``` You should see: `152`. 2. Split the rows by flag and count each group: ```python parts = readings.groupby("flag").size() parts ``` You should see: one group. Nothing warns you that anything is missing. ```text flag S 2 dtype: int64 ``` 3. Add the parts up and put the total beside the whole: ```python int(parts.sum()), len(readings) ``` You should see: `(2, 152)`. The parts are 150 rows short. 4. The missing rows are the ones with a blank flag: a grouping leaves out blank keys unless told otherwise. Tell it otherwise: ```python parts = readings.groupby("flag", dropna=False).size() parts ``` You should see: ```text flag S 2 NaN 150 dtype: int64 ``` 5. Check again: ```python int(parts.sum()) == len(readings) ``` You should see: `True`. 6. The same check works for a sum. Split the rainfall by gauge, and compare the groups' total with the column's: ```python by_gauge = readings.groupby("gauge_id")["value"].sum() round(float(by_gauge.sum()), 2), round(float(readings["value"].sum()), 2) ``` You should see: `(1075.43, 1075.43)`. No row has a blank `gauge_id`, so this split loses nothing. ## Check it worked You have two comparisons in your notebook where the parts equal the whole: 152 rows by flag, and 1075.43 by gauge. You can say which rows the first split dropped and why. ## If it didn't **Step 3 shows `(152, 152)`.** `parts` was already made with `dropna=False`. That is the corrected version; run step 2 again to see the short one. **The two numbers in step 6 differ in the last decimal place.** Sums of decimal numbers can differ by a tiny amount depending on the order of adding. Rounding both, as the step does, removes that. ## Next - [Tally a quality flag before you trust a number](https://idss-mesa.github.io/trainings/tutorials/tally-a-quality-flag/), which counts the blanks directly. - [Check a result a second way](https://idss-mesa.github.io/trainings/tutorials/check-a-result-two-ways/) - Reference: [Group by: split-apply-combine](https://pandas.pydata.org/docs/user_guide/groupby.html) in the pandas user guide. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17; the code was run there that day (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/compare-two-files/ --- type: Guide title: "Compare two files that should look alike" description: "Put July's and August's readings side by side, by row count, by gauge and by largest value, so that what is unusual in one month stands out against the other." tags: [byte, p4, exploration, verification, pandas] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pandas resource: "https://pandas.pydata.org/docs/user_guide/groupby.html" title: "Group by: split-apply-combine (pandas user guide)" author: "team:pandas-dev" --- # Compare two files that should look alike !!! warning "Draft: not yet validated" The code on this page was run inside MESA JupyterLab on 2026-11-17, by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a menu or a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A second file of the same kind is a free expectation. Two months from the same five gauges should have the same columns, about the same number of rows, and values of a similar size. Where they differ is where to look. **You will:** have a short list of the places where July's readings and August's differ, each one a question to follow up. **Time:** 10 minutes. **You need:** the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with its first cell run, and `readings_august.csv` from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/) in the same folder. ## Steps 1. Load August and compare the row counts. Five gauges over 31 days would give 155 rows in each month. ```python august = pd.read_csv("readings_august.csv") len(readings), len(august) ``` You should see: `(152, 151)`. Neither month is complete. 2. Check that the columns match: ```python list(readings.columns) == list(august.columns) ``` You should see: `True`. 3. Count the rows for each gauge, with the months side by side: ```python pd.DataFrame({ "july": readings.groupby("gauge_id")["value"].count(), "august": august.groupby("gauge_id")["value"].count(), }) ``` You should see: 31 nearly everywhere. July is short at G01 and one over at G03. August is short at G03. ```text july august gauge_id G01 27 31 G02 31 31 G03 32 27 G04 31 31 G05 31 31 ``` 4. Do the same for the largest reading: ```python pd.DataFrame({ "july": readings.groupby("gauge_id")["value"].max(), "august": august.groupby("gauge_id")["value"].max(), }) ``` You should see: four gauges within 0.2 of their other month, and G05 with 180 in July against 27.4 in August. ```text july august gauge_id G01 24.90 24.80 G02 2.92 2.84 G03 32.50 32.30 G04 26.40 26.30 G05 180.00 27.40 ``` 5. Compare the flags. July has two readings flagged `S`. For August: ```python august["flag"].value_counts(dropna=False) ``` You should see: no flag on any row. ```text flag NaN 151 Name: count, dtype: int64 ``` 6. In a Markdown cell, list each difference as a question. You should see: a list such as "July G01: four days missing? July G03: a repeated row? July G05: is 180 real? August G03: four days missing?" ## Check it worked Your list has four entries, each naming a month and a gauge. None of them is answered yet: the comparison tells you where to look, not what happened. ## If it didn't **Step 1 says the file is not found.** `readings_august.csv` is not in the folder the notebook is in. Run the download cell on the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/) page. **A table shows `NaN` for a gauge.** That gauge has no rows in one of the files. That is a difference too; add it to your list. ## Next - [Count records per day to find incomplete days](https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/), for the short and long gauges. - [Find and remove a repeated row](https://idss-mesa.github.io/trainings/tutorials/remove-a-repeated-row/) - [Plot a column to spot odd values](https://idss-mesa.github.io/trainings/tutorials/plot-to-spot-odd-values/), for the 180. - Reference: [Group by: split-apply-combine](https://pandas.pydata.org/docs/user_guide/groupby.html) in the pandas user guide. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17; the code was run there that day (pandas 3.1.1, DuckDB 2.0.0).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-plot-to-spot-odd-values/ --- type: Guide title: "Plot a column to spot odd values in R" description: "Draw one box per gauge for a column of readings in R, so that a value far from the rest, or a gauge on a different scale, shows up at a glance." tags: [byte, p4, rstudio, r, exploration, plotting] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/boxplot.html" title: "Box Plots: boxplot (R documentation)" author: "team:r-core" --- # Plot a column to spot odd values in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-17 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A table of 152 numbers hides what a picture shows in a second. This check suits any column of measurements, whoever or whatever produced it. **You will:** have found one reading and one gauge in `readings` that do not sit with the rest, from a chart. **Time:** 10 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. In the **Console**, draw one box per gauge: ```r boxplot(value ~ gauge_id, data = readings) ``` You should see: a chart in the **Plots** pane, with five boxes squashed below 35 and a single circle near 180 above **G05**. 2. Find the row behind the circle: ```r readings[readings$value > 100, ] ``` You should see: ```text gauge_id date value flag 130 G05 2026-07-09 180 S ``` 3. One extreme value sets the scale for everything else. Draw the chart again without it, to look at the rest: ```r boxplot(value ~ gauge_id, data = readings[readings$value < 100, ]) ``` You should see: the axis now ends near 35. Four gauges reach 25 to 33. The box for **G02** stays under 3. 4. A gauge ten times lower than its neighbours is either in a much drier place or on a different scale. Look at the gauge table: ```r gauges ``` You should see: `cm` in the `unit` column for G02, and `mm` for the others. ```text gauge_id name unit elevation_m 1 G01 Boathouse mm 512 2 G02 Orchard cm 540 3 G03 Observatory mm 688 4 G04 Depot mm 521 5 G05 Quarry mm 603 ``` 5. Write down, as comments in your script or in a notes file, the two things the chart showed and what you would do about each before computing with `value`. You should see: a note such as "G05 has one reading of 180 on 2026-07-09, flagged S. G02 is recorded in cm, the others in mm." ## Check it worked You can name the date of the odd reading and the gauge on a different scale, and you found both from the chart before you looked at any row. ## If it didn't **No chart appears.** The **Plots** pane may be hidden behind **Files** or **Help** at the bottom right. Click the **Plots** tab. **The second chart looks like the first.** The filter was left out. Check that the line ends `data = readings[readings$value < 100, ])`. ## Next - [Tally a quality flag in R](https://idss-mesa.github.io/trainings/tutorials/r-tally-a-quality-flag/), for what the `S` on that row means. - [Bring two units onto one scale in R](https://idss-mesa.github.io/trainings/tutorials/r-convert-units-before-comparing/), to put G02 on the same scale as the others. - Reference: [boxplot](https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/boxplot.html) in the R documentation. *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-check-a-result-two-ways/ --- type: Guide title: "Check a result a second way in R" description: "Count the same rows two ways in R, find out why the two disagree, and keep a result only once two independent routes give the same answer." tags: [byte, p4, rstudio, r, verification, missing-values] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/base/html/subset.html" title: "Subsetting Vectors, Matrices and Data Frames: subset (R documentation)" author: "team:r-core" --- # Check a result a second way in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-17 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). If two different routes give the same answer, a mistake would have to be made twice, in the same way, to go unnoticed. If they disagree, you have found something before your reader does. This works for a result of your own, a colleague's, or an AI assistant's. **You will:** have counted the readings not flagged as suspect in two ways, explained why the counts differ, and reached a total that two routes agree on. **Time:** 10 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. In the **Console**, count the readings whose flag is not `S`: ```r nrow(subset(readings, flag != "S")) ``` You should see: ```text [1] 0 ``` 2. Count them again, with square brackets: ```r odd <- readings[readings$flag != "S", ] nrow(odd) ``` You should see: a different answer. At least one route is not doing what you meant. ```text [1] 150 ``` 3. Look at the rows the second route kept: ```r head(odd, 3) ``` You should see: rows with nothing in them. ```text gauge_id date value flag NA NA NA.1 NA NA.2 NA ``` Most flags are missing, and comparing a missing value with `"S"` gives `NA`, neither true nor false. `subset()` drops those rows. Square brackets keep one empty row for each. Neither route kept the 150 unflagged readings. 4. Say what you mean: keep a row if its flag is missing or is not `S`. ```r kept <- readings[is.na(readings$flag) | readings$flag != "S", ] nrow(kept) ``` You should see: ```text [1] 150 ``` 5. Check the total rainfall in `kept` by a route that does not use `kept`: the whole column, less the readings flagged `S`. ```r sum(kept$value) sum(readings$value) - sum(readings$value[which(readings$flag == "S")]) ``` You should see: the same number twice. ```text [1] 895.43 [1] 895.43 ``` ## Check it worked Two routes give 895.43, and you can say why step 1 counted no rows and why the 150 in step 2 was not the 150 you wanted. ## If it didn't **Step 5 prints `NA`.** `kept` was made with the square brackets of step 2, so it holds empty rows. Make it again with the line in step 4. **The two routes agree but you doubt both.** Agreement shows the two were computed the same way, not that the data is sound. This total still mixes units. ## Next - [Check that the parts add up to the whole in R](https://idss-mesa.github.io/trainings/tutorials/r-check-parts-add-up/) - [Tally a quality flag in R](https://idss-mesa.github.io/trainings/tutorials/r-tally-a-quality-flag/) - Reference: [subset](https://stat.ethz.ch/R-manual/R-devel/library/base/html/subset.html) in the R documentation. *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-check-parts-add-up/ --- type: Guide title: "Check that the parts add up to the whole in R" description: "After splitting an R data frame into groups, add the groups back up and compare with the whole table, so that rows dropped without warning are noticed." tags: [byte, p4, rstudio, r, verification, missing-values] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/base/html/table.html" title: "Cross Tabulation and Table Creation: table (R documentation)" author: "team:r-core" --- # Check that the parts add up to the whole in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-17 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Splitting a table into groups should lose nothing: the groups, added up, should give the table back. When they do not, rows have gone missing without an error message. **You will:** have caught 150 rows that a tally dropped without warning, and confirmed a split that loses none. **Time:** 10 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/). ## Steps 1. In the **Console**, state the whole before you split it: ```r nrow(readings) ``` You should see: ```text [1] 152 ``` 2. Count the rows for each flag: ```r parts <- table(readings$flag) parts ``` You should see: one group. Nothing warns you that anything is missing. ```text S 2 ``` 3. Add the parts up and put the total beside the whole: ```r c(sum(parts), nrow(readings)) ``` You should see: the parts 150 rows short. ```text [1] 2 152 ``` 4. The missing rows are the ones with no flag: `table()` leaves out missing values unless told otherwise. Tell it otherwise: ```r parts <- table(readings$flag, useNA = "ifany") parts ``` You should see: ```text S 2 150 ``` 5. Check again: ```r sum(parts) == nrow(readings) ``` You should see: ```text [1] TRUE ``` 6. The same check works for a sum. Split the rainfall by gauge, and compare the groups' total with the column's: ```r by_gauge <- tapply(readings$value, readings$gauge_id, sum) c(sum(by_gauge), sum(readings$value)) ``` You should see: the same number twice. No row is missing its `gauge_id`, so this split loses nothing. ```text [1] 1075.43 1075.43 ``` ## Check it worked You have made two comparisons where the parts equal the whole: 152 rows by flag, and 1075.43 by gauge. You can say which rows the first tally dropped and why. ## If it didn't **Step 3 shows `[1] 152 152`.** `parts` was already made with `useNA = "ifany"`. That is the corrected version; run step 2 again to see the short one. **Step 6 shows `NA`.** A value is missing somewhere in the column. Run `sum(is.na(readings$value))`; in the practice data it is 0. ## Next - [Tally a quality flag in R](https://idss-mesa.github.io/trainings/tutorials/r-tally-a-quality-flag/), which counts the missing flags directly. - [Check a result a second way in R](https://idss-mesa.github.io/trainings/tutorials/r-check-a-result-two-ways/) - Reference: [table](https://stat.ethz.ch/R-manual/R-devel/library/base/html/table.html) in the R documentation. *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-compare-two-files/ --- type: Guide title: "Compare two files that should look alike in R" description: "Put July's and August's readings side by side in R, by row count, by gauge and by largest value, so that what is unusual in one month stands out against the other." tags: [byte, p4, rstudio, r, exploration, verification] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/base/html/tapply.html" title: "Apply a Function Over a Ragged Array: tapply (R documentation)" author: "team:r-core" --- # Compare two files that should look alike in R !!! warning "Draft: not yet validated" The code on this page was run inside MESA RStudio Geospatial on 2026-11-17 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A second file of the same kind is a free expectation. Two months from the same five gauges should have the same columns, about the same number of rows, and values of a similar size. Where they differ is where to look. **You will:** have a short list of the places where July's readings and August's differ, each one a question to follow up. **Time:** 10 minutes. **You need:** the `readings` and `gauges` tables from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/), with R's working folder still set to `mesa-practice`. ## Steps 1. In the **Console**, fetch August's file into the working folder: ```r download.file("https://idss-mesa.github.io/trainings/assets/practice/readings_august.csv", "readings_august.csv") ``` You should see: a few lines, the last of which begins `downloaded`. 2. Load it, then compare the row counts and the column names. Five gauges over 31 days would give 155 rows in each month. ```r august <- read.csv("readings_august.csv", na.strings = "") c(nrow(readings), nrow(august)) identical(names(readings), names(august)) ``` You should see: neither month complete, and the same columns in both. ```text [1] 152 151 [1] TRUE ``` 3. Count the rows for each gauge, with the months side by side: ```r cbind(july = table(readings$gauge_id), august = table(august$gauge_id)) ``` You should see: 31 nearly everywhere. July is short at G01 and one over at G03. August is short at G03. ```text july august G01 27 31 G02 31 31 G03 32 27 G04 31 31 G05 31 31 ``` 4. Do the same for the largest reading: ```r cbind( july = tapply(readings$value, readings$gauge_id, max), august = tapply(august$value, august$gauge_id, max) ) ``` You should see: four gauges within 0.2 of their other month, and G05 with 180 in July against 27.4 in August. ```text july august G01 24.90 24.80 G02 2.92 2.84 G03 32.50 32.30 G04 26.40 26.30 G05 180.00 27.40 ``` 5. Compare the flags. July has two readings flagged `S`. For August: ```r table(august$flag, useNA = "ifany") ``` You should see: no flag on any row. ```text 151 ``` 6. Write each difference down as a question, as comments in your script or in a notes file. You should see: a list such as "July G01: four days missing? July G03: a repeated row? July G05: is 180 real? August G03: four days missing?" ## Check it worked Your list has four entries, each naming a month and a gauge. None of them is answered yet: the comparison tells you where to look, not what happened. ## If it didn't **Step 2 says `cannot open file 'readings_august.csv'`.** The file is not in R's working folder. Run `getwd()` to see where R is looking, then repeat step 1. **`cbind` warns that the lengths differ.** One file has a gauge the other lacks. That is a difference too; add it to your list. ## Next - [Count records per day in R](https://idss-mesa.github.io/trainings/tutorials/r-count-records-per-day/), for the short and long gauges. - [Find and remove a repeated row in R](https://idss-mesa.github.io/trainings/tutorials/r-remove-a-repeated-row/) - [Plot a column to spot odd values in R](https://idss-mesa.github.io/trainings/tutorials/r-plot-to-spot-odd-values/), for the 180. - Reference: [tapply](https://stat.ethz.ch/R-manual/R-devel/library/base/html/tapply.html) in the R documentation. *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/write-a-readme/ --- type: Guide title: "Write a README for a data folder" description: "Add a short README file to a folder in your Data Store, from MESA JupyterLab, that says what the files are, where they came from, and who to ask." tags: [byte, p5, documentation, jupyterlab, data-store] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" --- # Write a README for a data folder !!! warning "Draft: not yet validated" These steps were followed once in MESA JupyterLab on 2026-11-13, by the AI assistant that drafted them, except that the rename in step 5 was done from a terminal and the preview in step 6 was not seen. No person has yet followed them. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A folder of data without a description is a puzzle for the next person, and in six months that person is you. A README is a plain text file, kept with the data, that answers the first questions anyone asks. **You will:** have a `README.md` in a folder of your Data Store that describes what is in it. **Time:** 10 minutes. **You need:** [MESA JupyterLab running](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), and a folder of your own to describe, such as `mesa-practice` from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). ## Steps 1. In JupyterLab's file browser, open the folder you want to describe. Click the **+** button at the top of the file browser if no **Launcher** tab is open. You should see: a **Launcher** tab that names your folder at its top. 2. In the **Launcher**, under **Other**, click **Markdown File**. You should see: an empty editor tab named `untitled.md`, and the same file in the file browser. 3. Type the description. Five short parts cover most folders: ```markdown # Practice rain-gauge data Synthetic data from the MESA Trainings tutorials. It describes no real place. ## Files - `gauges.csv`: one row per rain gauge (5 rows) - `readings.csv`: one row per gauge and day, July 2026 (152 rows) ## Source https://idss-mesa.github.io/trainings/tutorials/practice-data/ ## Notes - Orchard (G02) reports in centimetres; the other gauges report in millimetres. - Readings flagged `S` were marked suspect by the sensor. ## Contact Your name, your email address ``` You should see: the headings in bold in the editor. 4. Choose **File → Save Markdown File**. You should see: *Saving completed* in the bar at the bottom, and the dot on the tab disappear. 5. In the file browser, right-click `untitled.md`, choose **Rename**, and type `README.md`. You should see: `README.md` in the file browser. By convention that name is the one people look for first. 6. Right-click inside the editor and choose **Show Markdown Preview**. You should see: the README laid out with headings and bullets, beside the text. ## Check it worked `README.md` is listed in the folder, in JupyterLab and in the portal's Data Browser, and a person who has never seen the folder could say from it what each file holds. ## If it didn't **The folder has both `untitled.md` and `README.md`.** You chose **File → Save Markdown File As…**, which writes a second copy. Open `README.md` to check it is complete, then right-click `untitled.md` and choose **Delete**. ## Next - [Record the software versions a result depends on](https://idss-mesa.github.io/trainings/tutorials/record-software-versions/) - [Add metadata to a file or folder](https://idss-mesa.github.io/trainings/tutorials/add-metadata/), which makes the same facts searchable by tools. - [Share a folder with a collaborator](https://idss-mesa.github.io/trainings/tutorials/share-a-folder/) - Reference: [MESA JupyterLab](https://idss-mesa.github.io/docs/apps/jupyterlab/). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed in MESA JupyterLab that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/add-metadata/ --- type: Guide title: "Add metadata to a file or folder" description: "Describe a folder in your Data Store with an attribute and a value from the MESA Portal's Data Browser, and confirm the description was saved." tags: [byte, p5, portal, data-browser, metadata] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-12T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Add metadata to a file or folder !!! warning "Draft: not yet validated" These steps were followed on the live portal on 2026-11-13, on a newly created account, by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). The Data Store keeps metadata as *AVUs*: an attribute, a value, and an optional unit. "Elevation, 512, m" is one AVU. Metadata stays attached to the file or folder, so it reaches whoever you share the data with, and AI agents using the MESA tools can read it. **You will:** have a folder that says, in its own metadata, what it contains. **Time:** 5 minutes. **You need:** to be [signed in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/), and a folder of your own in **My Files**, such as the `mesa-practice` folder from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). ## Steps 1. In the sidebar, click **Data Browser**, then **My Files**. You should see: a card for each of your files and folders, each with a small **AVUs** button under its name. 2. Click **AVUs** under the folder's name. You should see: a panel listing the folder's AVUs. For a folder you have just made it says *No AVUs yet*. ![The AVU panel for data.csv, with editable attribute, value, and unit fields](https://idss-mesa.github.io/docs/assets/portal/data-avus.webp){ width="560" } 3. Click **Add row**. You should see: an empty row with three fields: attribute, value, and unit. 4. Type `description` as the attribute and a short sentence as the value, for example `Synthetic rain-gauge practice data from the MESA tutorials`. Leave the unit empty. You should see: your text in the two fields. 5. Click **Add row** again and enter `contact` with your name as the value. You should see: two rows. 6. Click **Save**. You should see: **Saved.** in the panel, with both rows still listed. 7. Refresh the page and click **AVUs** on the folder again. You should see: both rows, as you typed them. ## Check it worked After a page refresh, the folder's AVU panel still lists `description` and `contact` with your values. ## If it didn't **The fields cannot be edited, or there is no Add row.** You can read the folder but not write to it. Open the folder and read its header: you need **Owner** or **Can edit**, not **Read only**. Use a folder under **My Files**. ## Next - [Share a folder with a collaborator](https://idss-mesa.github.io/trainings/tutorials/share-a-folder/) - [Describe a folder with DataCite fields](https://idss-mesa.github.io/trainings/tutorials/describe-with-datacite-fields/) - Reference: [Managing data, "Describe data with metadata (AVUs)"](https://idss-mesa.github.io/docs/portal/data/#describe-data-with-metadata-avus), which covers reserved attribute names and the full metadata page with its DataCite, Dublin Core, and EML views. *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-12 from the MESA documentation and followed once on the live portal on 2026-11-13.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/describe-with-datacite-fields/ --- type: Guide title: "Describe a folder with DataCite fields" description: "Fill in a folder's title, publisher, year, type, and creator on the MESA Portal's full metadata page, and see the standard-named AVUs it saves." tags: [byte, p5, portal, data-browser, metadata] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-24T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Describe a folder with DataCite fields !!! warning "Draft: not yet validated" The AI assistant that drafted this tutorial followed these steps on the live portal on 2026-11-24, on a test account, and saw the results shown. It filled in five fields and did not try the others on the form. No person has yet followed the page. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). An attribute you name yourself, such as `description`, means what you say it means. DataCite is a standard set of fields for describing a dataset: title, creator, publisher, year, type. The portal has a form for them, and saves each as an AVU with a standard name that other people and tools can recognise. **You will:** have a folder that carries its title, creator, publisher, year, and type under DataCite's names. **Time:** 5 to 10 minutes. **You need:** to have finished [Add metadata to a file or folder](https://idss-mesa.github.io/trainings/tutorials/add-metadata/), so that your folder has a `description`. ## Steps 1. In **Data Browser**, **My Files**, click **AVUs** under the folder's name, then **Open full metadata page** at the foot of the panel. You should see: a page headed with the folder's name and a row of tabs that starts **Raw AVUs**, **DataCite**, **Dublin Core**, **EML**. 2. Click **DataCite**. You should see: a form headed **DataCite Schema**. **Description** already shows the `description` you added earlier; the other fields are empty. 3. Fill in four fields. For the practice folder: | Field | Value | |---|---| | **Title** | `MESA practice data: five invented rain gauges` | | **Publisher** | `MESA Trainings` | | **Publication Year** | `2026` | | **Resource Type General** | `Dataset` | You should see: your text in the four fields. Leave **Identifier (DOI)** empty unless the data already has one. 4. Scroll down to **Creators** and click **Add Creator**. You should see: **Creator #1**, with fields for **Name**, **ORCID**, and **Affiliation**. Only the name is marked as required. 5. Type the creator's name. For a person, the field suggests family name first: `Last, First`. For the practice folder, type `MESA Trainings`. You should see: the name in the field. 6. Scroll back to the top of the form and click **Save**. You should see: **Saving metadata…** for a few seconds. Then the count beside the folder's name goes up by five; in the example, from **2 AVUs** to **7 AVUs**. 7. Click **Raw AVUs**. You should see: your earlier rows and five new ones. | Attribute | Value | |---|---| | `datacite.title` | MESA practice data: five invented rain gauges | | `datacite.publisher` | MESA Trainings | | `datacite.publicationYear` | 2026 | | `datacite.resourceTypeGeneral` | Dataset | | `datacite.creator.1.name` | MESA Trainings | ## Check it worked After you refresh the page, **Raw AVUs** still lists the five `datacite.` rows, and the **DataCite** tab shows your values. Your `description` row is unchanged: the form showed it, and did not save a second copy under a DataCite name. ## If it didn't **There is no Save button, or the fields cannot be edited.** You can read the folder but not write to it. Use a folder under **My Files**. **The count has not changed.** Saving took several seconds when this was tried. Wait, then refresh the page and look at **Raw AVUs** again. ## Next - [Add Dublin Core fields to a folder](https://idss-mesa.github.io/trainings/tutorials/describe-with-dublin-core-fields/) - [Say where your input data came from](https://idss-mesa.github.io/trainings/tutorials/say-where-data-came-from/) - [Read the metadata on a folder shared with you](https://idss-mesa.github.io/trainings/tutorials/read-shared-metadata/) - Reference: [Managing data, "Describe data with metadata (AVUs)"](https://idss-mesa.github.io/docs/portal/data/#describe-data-with-metadata-avus). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-24 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/describe-with-dublin-core-fields/ --- type: Guide title: "Add Dublin Core fields to a folder" description: "Fill in a folder's creator, subject, and rights on the Dublin Core tab of the MESA Portal's full metadata page, and see which fields the portal carries over for you." tags: [byte, p5, portal, data-browser, metadata] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-24T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Add Dublin Core fields to a folder !!! warning "Draft: not yet validated" The AI assistant that drafted this tutorial followed these steps on the live portal on 2026-11-24, on a test account, and saw the results shown. It filled in three fields and did not try the others on the form. No person has yet followed the page. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Dublin Core is a short, general set of fifteen fields that libraries and catalogues read. The portal has a form for it. Fields you have already described under another name are shown for you, so you type only what is missing. **You will:** have a folder that carries its creator, subject, and rights under Dublin Core's names. **Time:** 5 minutes. **You need:** to have finished [Describe a folder with DataCite fields](https://idss-mesa.github.io/trainings/tutorials/describe-with-datacite-fields/). ## Steps 1. In **Data Browser**, **My Files**, click **AVUs** under the folder's name, then **Open full metadata page** at the foot of the panel. Click **Dublin Core**. You should see: a form headed **Dublin Core**, with fifteen fields from **Title** to **Rights**. **Title**, **Description**, and **Publisher** already show the values you saved earlier. The rest are empty. 2. Fill in three fields. For the practice folder: | Field | Value | |---|---| | **Creator** | `MESA Trainings` | | **Subject** | `rainfall` | | **Rights** | `CC BY 4.0` | You should see: your text in the three fields. 3. Scroll back to the top of the form and click **Save**. You should see: after several seconds, the count beside the folder's name goes up by three; in the example, from **7 AVUs** to **10 AVUs**. When this was tried, the count had not changed after six seconds, and showed **10 AVUs** once the page was refreshed. 4. Refresh the page and click **Raw AVUs**. You should see: your earlier rows and three new ones. | Attribute | Value | |---|---| | `dc.creator` | MESA Trainings | | `dc.subject` | rainfall | | `dc.rights` | CC BY 4.0 | ## Check it worked **Raw AVUs** lists three `dc.` rows, and the **Dublin Core** tab shows all six values. There is no `dc.title`, `dc.description`, or `dc.publisher` row: the form showed those three from your `datacite.title`, `description`, and `datacite.publisher` rows, and did not save a second copy. ## If it didn't **Title, Description, or Publisher is empty.** The form fills them from AVUs you already have. Add them first with [Describe a folder with DataCite fields](https://idss-mesa.github.io/trainings/tutorials/describe-with-datacite-fields/), or type them here. **There is no Save button, or the fields cannot be edited.** You can read the folder but not write to it. Use a folder under **My Files**. ## Next - [Record where and when data was collected, with EML fields](https://idss-mesa.github.io/trainings/tutorials/describe-with-eml-fields/) - [Tag a folder with an ontology term](https://idss-mesa.github.io/trainings/tutorials/tag-with-an-ontology-term/) - Reference: [Managing data, "Describe data with metadata (AVUs)"](https://idss-mesa.github.io/docs/portal/data/#describe-data-with-metadata-avus). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-24 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/describe-with-eml-fields/ --- type: Guide title: "Record where and when data was collected, with EML fields" description: "Fill in a folder's place, bounding box, and date range on the EML tab of the MESA Portal's full metadata page, and see the eml. AVUs it saves." tags: [byte, p5, portal, data-browser, metadata] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-24T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Record where and when data was collected, with EML fields !!! warning "Draft: not yet validated" The AI assistant that drafted this tutorial followed these steps on the live portal on 2026-11-24, on a test account, and saw the results shown. It filled in seven fields and did not try the others on the form. No person has yet followed the page. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A title and a creator do not say where the measurements were taken, or over which days. The Ecological Metadata Language (EML) has fields for both, and the portal has a form for them. **You will:** have a folder that carries the place, the bounding box, and the date range of its data under EML's names. **Time:** 5 to 10 minutes. **You need:** to have finished [Add Dublin Core fields to a folder](https://idss-mesa.github.io/trainings/tutorials/describe-with-dublin-core-fields/), and to know the outermost points of your data and its first and last dates. ## Steps 1. In **Data Browser**, **My Files**, click **AVUs** under the folder's name, then **Open full metadata page** at the foot of the panel. Click **EML**. You should see: a form headed **Ecological Metadata Language**. **Title**, **Creator**, and **Contact** already show values you saved earlier. The rest are empty. 2. In **Geographic Coverage**, describe the place in words. For the practice folder, type `Five invented rain-gauge sites`. You should see: your text in the field. 3. Fill in the four bounds in decimal degrees. West of Greenwich and south of the equator are negative. For the practice folder, the values come from `gauge_sites.csv`: | Field | Value | |---|---| | **West Bound** | `-104.7612` | | **East Bound** | `-104.7228` | | **North Bound** | `47.1287` | | **South Bound** | `47.0962` | You should see: the four numbers in the fields. 4. Fill in **Begin Date** and **End Date**, as year, month, day. For the daily readings in the practice folder, type `2026-07-01` and `2026-07-31`. You should see: the two dates in the fields. 5. Scroll back to the top of the form and click **Save**. You should see: **Saving metadata…** Then the count beside the folder's name goes up by seven; in the example, from **10 AVUs** to **17 AVUs**. When this was tried, that took between ten and twenty seconds. 6. Click **Raw AVUs**. You should see: your earlier rows and seven new ones. | Attribute | Value | |---|---| | `eml.geographicCoverage` | Five invented rain-gauge sites | | `eml.westBoundingCoordinate` | -104.7612 | | `eml.eastBoundingCoordinate` | -104.7228 | | `eml.northBoundingCoordinate` | 47.1287 | | `eml.southBoundingCoordinate` | 47.0962 | | `eml.beginDate` | 2026-07-01 | | `eml.endDate` | 2026-07-31 | ## Check it worked After you refresh the page, **Raw AVUs** still lists the seven `eml.` rows, and the **EML** tab shows your values. Read the bounds back against your data: west is the smaller longitude, south the smaller latitude. ## If it didn't **Creator is empty.** When this was tried, the form showed a creator only after one had been saved on the **Dublin Core** tab. Type it here, or add it there first. **The count has not changed.** Wait, then refresh the page and look at **Raw AVUs** again. **There is no Save button, or the fields cannot be edited.** You can read the folder but not write to it. Use a folder under **My Files**. ## Next - [Make a folder's metadata valid Croissant](https://idss-mesa.github.io/trainings/tutorials/make-metadata-valid-croissant/) - [Say where your input data came from](https://idss-mesa.github.io/trainings/tutorials/say-where-data-came-from/) - Reference: [Managing data, "Describe data with metadata (AVUs)"](https://idss-mesa.github.io/docs/portal/data/#describe-data-with-metadata-avus). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-24 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/make-metadata-valid-croissant/ --- type: Guide title: "Make a folder's metadata valid Croissant" description: "Use the Croissant tab of the MESA Portal's full metadata page to see which required properties a folder lacks, add a description and a licence, and reach a valid Croissant document." tags: [byte, p5, portal, data-browser, metadata] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-24T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Make a folder's metadata valid Croissant !!! warning "Draft: not yet validated" The AI assistant that drafted this tutorial followed these steps on the live portal on 2026-11-24, on a test account, and saw the results shown. It added a description and a licence. It did not describe files or record sets, and did not download the document. No person has yet followed the page. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). Croissant is a format that describes a dataset so that machine-learning tools can load it. It has six required properties. The portal checks your folder against them as you type, and fills in what it can from fields you have already saved. **You will:** have a folder whose metadata the portal reports as valid Croissant. **Time:** 5 to 10 minutes. **You need:** to have finished [Describe a folder with DataCite fields](https://idss-mesa.github.io/trainings/tutorials/describe-with-datacite-fields/). ## Steps 1. In **Data Browser**, **My Files**, click **AVUs** under the folder's name, then **Open full metadata page** at the foot of the panel. Click **Croissant**. You should see: a panel headed **Croissant** with a red **2 errors** beside it. Under your title, **Required properties** reads **4 of 6**. **Validation** lists the two that are missing: **description is required** and **license is required**. 2. Click **Dataset** in the row of views under the heading. You should see: a form. **Name**, **Date published**, **Creators**, and **Publishers** show your values, each marked **From DataCite**. 3. In **Description**, say what the data is. For the practice folder, type `Synthetic rain-gauge practice data from the MESA tutorials`. You should see: your text in the box. The form does not take this from a `description` AVU; you type it again. 4. Scroll down to **License** and click **Add license**. In the field that appears, type the address of the licence. For the practice folder, type `https://creativecommons.org/licenses/by/4.0/`. You should see: the address in the field. 5. Scroll back to the top and click **Overview**. You should see: a green **Valid, 1 warning · unsaved** beside the heading, and **Required properties** at **6 of 6**. The warning says **distribution is empty**: no files are described yet. 6. Click **Save**. You should see: the word **unsaved** go, and the count beside the folder's name go up by two; in the example, from **17 AVUs** to **19 AVUs**. Allow twenty seconds. 7. Click **Raw AVUs**. You should see: two new rows. | Attribute | Value | |---|---| | `croissant.description` | Synthetic rain-gauge practice data from the MESA tutorials | | `croissant.license.1` | https://creativecommons.org/licenses/by/4.0/ | ## Check it worked After you refresh the page, the **Croissant** tab still reads **Valid**, and its **JSON-LD** view shows the whole document, with your name, description, licence, creator, publisher, and year. The warning about distribution stays until you describe the files, which is a separate task. ## If it didn't **The count of errors or warnings differs.** The panel counts what your folder lacks, so your numbers may differ. When this was tried, a folder that also had an ontology term showed one more warning, about keywords. **It still reads unsaved.** Click **Save** again and wait; then refresh the page. **There is no Save button, or the fields cannot be edited.** You can read the folder but not write to it. Use a folder under **My Files**. ## Next - [Tag a folder with an ontology term](https://idss-mesa.github.io/trainings/tutorials/tag-with-an-ontology-term/) - [Say where your input data came from](https://idss-mesa.github.io/trainings/tutorials/say-where-data-came-from/) - Reference: [Managing data, "Describe data with metadata (AVUs)"](https://idss-mesa.github.io/docs/portal/data/#describe-data-with-metadata-avus). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-24 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/tag-with-an-ontology-term/ --- type: Guide title: "Tag a folder with an ontology term" description: "Find a term in the Environment Ontology on the Ontologies tab of the MESA Portal's full metadata page, add it to a folder, and see the AVU that carries the term's identifier." tags: [byte, p5, portal, data-browser, metadata] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-24T00:00:00Z" } stale_after: "2027-05-24T00:00:00Z" sources: - id: docs resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" --- # Tag a folder with an ontology term !!! warning "Draft: not yet validated" The AI assistant that drafted this tutorial followed these steps on the live portal on 2026-11-24, on a test account, and saw the results shown. It added one term from one ontology, ENVO, and did not try the others. No person has yet followed the page. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A keyword such as `rainfall` is a word you chose. Someone else may have chosen `precipitation`. An ontology term is a word with an identifier and a definition that a community has agreed. Tag a folder with one and a search by that identifier finds it, whatever word you would have used. **You will:** have a folder tagged with a term from the Environment Ontology (ENVO). **Time:** 5 minutes. **You need:** a folder of your own under **My Files**. ## Steps 1. In **Data Browser**, **My Files**, click **AVUs** under the folder's name, then **Open full metadata page** at the foot of the panel. Click **Ontologies**. You should see: a panel headed **Ontology Explorer**, a search box, and rows of buttons under **Environmental Sciences**, **General Biology**, and **Registries**. 2. Click **ENVO**. You should see: **Loading ENVO…** for several seconds. Then a panel headed **Environment Ontology** with a few terms listed, and at its foot a second search box labelled **Add term from ENVO**. 3. In that second box, type a word for what your data is about. For the practice folder, type `rain`. You should see: a list of terms, each with an identifier and the start of its definition. The first is **rain**, `ENVO:01001564`. 4. Read the definition, then click the term that fits. For the practice folder, click **rain**. You should see: a new row in the panel, **rain**, marked **NEW**, with `ENVO:01001564` under it and the word `rain` in the field beside it. 5. Scroll back to the top of the panel and click **Save**. You should see: after ten to twenty seconds, the count beside the folder's name goes up by one; in the example, from **19 AVUs** to **20 AVUs**. A line appears under the first search box: **1 namespaced AVU on this item**, with an **ENVO** button. 6. Click **Raw AVUs**. You should see: one new row. The term's identifier is in the **Unit** column. | Attribute | Value | Unit | |---|---|---| | `envo.rain` | rain | ENVO:01001564 | ## Check it worked After you refresh the page, **Raw AVUs** still lists the `envo.rain` row with its identifier, and the **Ontologies** tab still shows **1 namespaced AVU on this item**. ## If it didn't **The search lists whole ontologies, not terms.** You typed in the first search box, which searches the names of ontologies. When this was tried, `rain` there returned nine, most of them atlases of the brain. Click **ENVO** first, then use the box labelled **Add term from ENVO**. **No term fits.** Try a broader word, or another ontology from the buttons. Do not pick a term whose definition does not match your data: a wrong identifier misleads more than a missing one. **There is no Save button, or the fields cannot be edited.** You can read the folder but not write to it. Use a folder under **My Files**. ## Next - [Make a folder's metadata valid Croissant](https://idss-mesa.github.io/trainings/tutorials/make-metadata-valid-croissant/) - [Read the metadata on a folder shared with you](https://idss-mesa.github.io/trainings/tutorials/read-shared-metadata/) - Reference: [Managing data, "Describe data with metadata (AVUs)"](https://idss-mesa.github.io/docs/portal/data/#describe-data-with-metadata-avus). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-24 and followed once on the live portal that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/record-software-versions/ --- type: Guide title: "Record the software versions a result depends on" description: "Write the Python version and the versions of every installed package to files beside your work, so that a result can be traced to the software that produced it." tags: [byte, p5, reproducibility, jupyterlab, environment] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-13T00:00:00Z" } stale_after: "2027-05-13T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: pip resource: "https://pip.pypa.io/en/stable/cli/pip_list/" title: "pip list (pip documentation)" author: "team:pypa" --- # Record the software versions a result depends on !!! warning "Draft: not yet validated" The commands on this page were run in MESA JupyterLab on 2026-11-13, by the AI assistant that drafted it, and produced the output shown. No person has yet followed the steps. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). The software in a MESA app changes when the app is rebuilt. A number you computed today may not come out the same next year, and without a record you cannot tell whether the data or the software changed. **You will:** have two small files beside your work that say which Python and which package versions it ran on. **Time:** 5 minutes. **You need:** [MESA JupyterLab running](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), and a folder that holds your work, such as `mesa-practice` from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). ## Steps 1. In JupyterLab's file browser, open the folder that holds your work. In the **Launcher**, click **Terminal**. You should see: a terminal whose prompt ends with the name of your folder. A terminal opened from the Launcher starts in the folder the file browser is showing. 2. Check the Python version: ```bash python --version ``` You should see: one line, such as `Python 3.13.18`. 3. Write every installed package and its version to a file: ```bash pip list --format=freeze > requirements.txt ``` You should see: no output, and `requirements.txt` in the file browser. 4. Count what was recorded: ```bash wc -l requirements.txt ``` You should see: a few hundred lines, one for each package. In our test: ```text 244 requirements.txt ``` 5. Look up the packages your work imports: ```bash grep -E '^(pandas|duckdb|numpy)==' requirements.txt ``` You should see: one line for each, with its version. In our test: ```text duckdb==2.0.0 numpy==2.5.4 pandas==3.1.1 ``` 6. Write a one-line note that ties the two together and dates them: ```bash echo "Python $(python --version | cut -d' ' -f2), packages in requirements.txt, recorded $(date +%F)" > environment.txt cat environment.txt ``` You should see: the note. In our test: ```text Python 3.13.18, packages in requirements.txt, recorded 2026-11-13 ``` ## Check it worked The folder holds `requirements.txt` and `environment.txt`, and step 5 shows a version for each package your work imports. ## If it didn't **Step 5 prints nothing.** The package names in the pattern do not match what is installed. Search for one name without the `==`, for example `grep -i pandas requirements.txt`, and use the spelling it shows. ## Next - These files record the software; they do not rebuild it. To run old work again you need an app with the same versions, or to install them yourself. - Record again whenever a result goes into a report: the date in `environment.txt` says which run the record belongs to. - [Leave a notebook someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/leave-a-rerunnable-notebook/) - [Write a README for a data folder](https://idss-mesa.github.io/trainings/tutorials/write-a-readme/), and mention these two files in it. *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-13 and followed in MESA JupyterLab that day.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/leave-a-rerunnable-notebook/ --- type: Guide title: "Leave a notebook someone else can rerun" description: "Restart a notebook and run it from the top, remove what ties it to your session, and say at the top what it needs, so that another person gets the same result." tags: [byte, p5, reproducibility, jupyterlab, notebook] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-12T00:00:00Z" } stale_after: "2027-05-12T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: jupyterlab resource: "https://jupyterlab.readthedocs.io/en/stable/user/notebook.html" title: "Notebooks (JupyterLab documentation)" author: "team:jupyterlab" --- # Leave a notebook someone else can rerun !!! warning "Draft: not yet validated" These steps were followed once inside MESA JupyterLab on 2026-11-16, by the AI assistant that drafted them, with the notebook saved by its keyboard shortcut. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A notebook remembers every cell you ran, in the order you ran it, including cells you have since changed or deleted. What it shows can therefore differ from what it produces when someone else runs it from the top. **You will:** have a notebook that runs from a fresh start, top to bottom, without you. **Time:** 5 to 10 minutes. **You need:** `practice.ipynb` from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), with whatever you have added to it since. ## Steps 1. Choose **Kernel → Restart Kernel and Run All Cells…** and confirm with **Restart**. You should see: every code cell numbered in order down the page, `[1]`, `[2]`, `[3]`, with no red error box. If a cell fails, go to "If it didn't" below, then come back. 2. Choose **Edit → Find…** and search the notebook for `/home/`. You should see: a search box at the top right of the notebook that reads `-/-`, which means no matches. A path that starts at your own home folder works only for you; a bare file name such as `"readings.csv"` works for anyone who has the file beside the notebook. 3. Click the first cell, press ++esc++, then ++a++ to add a cell above it, then ++m++ to make it a Markdown cell. Write what the notebook does, which files it needs, and where they come from: ```markdown # Checks on the practice rain-gauge data Needs `gauges.csv` and `readings.csv` in the same folder as this notebook. Both are at https://idss-mesa.github.io/trainings/tutorials/practice-data/ ``` You should see: the heading and the text, rendered, after you press ++shift+enter++. 4. Add a code cell at the very end that records what the notebook ran on: ```python import sys print("Python", sys.version.split()[0], "| pandas", pd.__version__) ``` You should see: one line with two version numbers. 5. Repeat step 1, then choose **File → Save Notebook**. You should see: the cells numbered in order again, and the outputs now saved in the file are the ones a fresh run produces. 6. Look at the `mesa-practice` folder in the file browser. You should see: `practice.ipynb`, `gauges.csv`, and `readings.csv`. The folder holds everything the notebook needs, so the folder is what you share. ## Check it worked After **Restart Kernel and Run All Cells…**, the code cells are numbered consecutively from `[1]` and none shows an error. Numbers that skip or run out of order mean cells were run by hand since the last restart. ## If it didn't **A cell stops with `NameError: name '...' is not defined`.** The cell uses something that was defined in a cell you later deleted or changed, or in a cell further down. It worked before only because the kernel still remembered the old definition. Put the definition in a cell above the one that failed, then repeat step 1. ## Next - [Record the software versions a result depends on](https://idss-mesa.github.io/trainings/tutorials/record-software-versions/) - Reference: [Managing data, "Share data"](https://idss-mesa.github.io/docs/portal/data/#share-data), for giving a colleague access to the folder. - Reference: [Notebooks](https://jupyterlab.readthedocs.io/en/stable/user/notebook.html) in the JupyterLab documentation. *Not yet validated by a person in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-12 and followed once there on 2026-11-16 (Python 3.13.18, pandas 3.1.1).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/say-where-data-came-from/ --- type: Guide title: "Say where your input data came from" description: "Record in a folder's README where its data came from, when you retrieved it, which version it is, and what its license allows, so that someone else can get the same data again." tags: [byte, p5, readme, provenance, license] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: jupyterlab resource: "https://jupyterlab.readthedocs.io/en/stable/user/file_editor.html" title: "Text editor (JupyterLab documentation)" author: "team:jupyterlab" --- # Say where your input data came from !!! warning "Draft: not yet validated" Nobody has yet followed this tutorial in MESA JupyterLab, so a menu name may differ there. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A result can be repeated only by someone who can get the same data. A link alone is not enough: the page behind it changes, and it does not say whether the data may be reused. Four facts, written down on the day you fetch the data, settle it. **You will:** have a **Source** section in your README that says where the data came from, when you got it, which version it is, and what its license allows. **Time:** 5 to 10 minutes. **You need:** the `README.md` from [Write a README for a data folder](https://idss-mesa.github.io/trainings/tutorials/write-a-readme/), in a folder open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/). ## Steps 1. In JupyterLab's file browser, double-click `README.md`. You should see: the README's text in an editor tab, with a `## Source` heading and one link under it. 2. Replace what is under `## Source` with a list of facts. For the practice data: ```markdown ## Source - From: https://idss-mesa.github.io/trainings/tutorials/practice-data/ - Made by: MESA Trainings. Synthetic data, written by a script. - Retrieved: 2026-11-15, with the download cell on that page - Version: the files as published on that date - License: CC BY 4.0 - Changed since: nothing ``` You should see: six lines, each starting with what it records. 3. Correct **Retrieved** to the day you copied the files, not today's date, and say how you got them: a download cell, a command, or an upload from your computer. You should see: a date and a method that would let you fetch the files the same way again. 4. Look up **License** on the source's own page. Do not write it from memory. For the practice data, the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/) page states it near the end. You should see: the license as the source words it. 5. Under **Changed since**, list anything you have done to the files after fetching them: rows removed, columns renamed, units converted. If the files are as they arrived, leave "nothing". You should see: a line that lets a reader tell your copy from the original. 6. Choose **File → Save Markdown File**. You should see: *Saving completed* in the bar at the bottom. ## Check it worked From the **Source** section alone, a reader can answer three questions: where to get the data again, whether they may reuse it, and whether your copy differs from the original. ## If it didn't **The source's page states no license.** Write `License: not stated on the source page`, with the date you looked. Do not guess one. Without a license you may not have the right to pass the data on, so ask whoever publishes it before you share the folder. ## Next - [Record the software versions a result depends on](https://idss-mesa.github.io/trainings/tutorials/record-software-versions/) - [Hand your folder to a colleague and have them rerun it](https://idss-mesa.github.io/trainings/tutorials/hand-over-and-rerun/) - Reference: [MESA JupyterLab](https://idss-mesa.github.io/docs/apps/jupyterlab/). *Not yet validated in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15 from the MESA documentation and the JupyterLab documentation.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/state-what-ai-did/ --- type: Guide title: "State what AI did in your analysis" description: "Add a section to a folder's README that says which AI tools helped with the analysis, what they were asked, what you kept, and how you checked it." tags: [byte, p5, readme, ai-agents, disclosure] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-18T00:00:00Z" } stale_after: "2027-05-18T00:00:00Z" sources: - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: jupyterlab resource: "https://jupyterlab.readthedocs.io/en/stable/user/file_editor.html" title: "Text editor (JupyterLab documentation)" author: "team:jupyterlab" --- # State what AI did in your analysis !!! warning "Draft: not yet validated" Nobody has yet followed this tutorial in MESA JupyterLab, so a menu name may differ there. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A reader of your result cannot tell which parts an AI assistant wrote unless you say so. "AI was used" tells them nothing they can check. A short section that names the tool, the steps, and your checks lets them decide what to look at twice. **You will:** have an **AI assistance** section in your README that covers every step an assistant helped with. **Time:** 5 to 10 minutes. **You need:** the `README.md` from [Write a README for a data folder](https://idss-mesa.github.io/trainings/tutorials/write-a-readme/), open in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), and the log from [Keep a log of AI-assisted steps](https://idss-mesa.github.io/trainings/tutorials/keep-an-ai-log/) if you kept one. ## Steps 1. In JupyterLab's file browser, double-click `README.md`. You should see: the README's text in an editor tab. 2. Above `## Contact`, add a heading and one line for each tool you used: ```markdown ## AI assistance - Tool and model: OpenCode, with the model gpt-oss-120b through CyVerse AI Verde - Used on: 2026-11-18 ``` You should see: the tool's own name and the model name it reported, not "an AI". 3. Under it, list every step the assistant helped with, one line each. Say what you asked for and what you did with the answer: ```markdown - Asked which gauge was wettest in July. Rejected the answer: it counted a reading flagged as suspect. - Asked for a query that totals rainfall by gauge. Kept it, after changing it to leave out flagged readings. ``` You should see: the answers you rejected listed beside the ones you kept. 4. Add how you checked what you kept, and what the assistant did not touch: ```markdown - Checked by: running each kept query myself and comparing the totals with a second method. - Not assisted: loading the files, the figures, and this README. - Full log: the "AI log" table at the end of `analysis.ipynb`. ``` You should see: a check you ran yourself, named. "Reviewed" is not a check. 5. Read the section against your log. Every row of the log should be covered by a line here. You should see: no assisted step missing, including small ones such as a fixed error message. 6. Choose **File → Save Markdown File**. You should see: *Saving completed* in the bar at the bottom. ## Check it worked From the **AI assistance** section alone, a reader can say which tool and model were used, which results rest on an assistant's answer, and how each of those was checked. ## If it didn't **You kept no log and cannot remember every step.** Say so in the section: write what you do remember, and add `Earlier assisted steps were not recorded`. Do not write a tidy list from memory as if it were complete. Then start a log for what comes next. ## Next - [Hand your folder to a colleague and have them rerun it](https://idss-mesa.github.io/trainings/tutorials/hand-over-and-rerun/) - [Say where your input data came from](https://idss-mesa.github.io/trainings/tutorials/say-where-data-came-from/) - If no assistant helped, say that too: `## AI assistance` followed by `None`. - Reference: [MESA JupyterLab](https://idss-mesa.github.io/docs/apps/jupyterlab/). *Not yet validated in MESA JupyterLab. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-18 from the MESA documentation and the JupyterLab documentation.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/hand-over-and-rerun/ --- type: Guide title: "Hand your folder to a colleague and have them rerun it" description: "Test whether your work can be repeated without you: share the folder, have a colleague copy it and run the notebook from a fresh start, and compare their result with the one you wrote down." tags: [byte, p5, reproducibility, sharing, notebook] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: docs-data resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" --- # Hand your folder to a colleague and have them rerun it !!! warning "Draft: not yet validated" This tutorial was written from the MESA documentation and from tutorials whose steps were followed on the live portal. Nobody has yet followed it from start to finish: it needs two accounts. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). You cannot tell from the inside whether your folder holds everything. You know where the files are, what to run first, and what the answer should be. The test is to give the folder to someone who knows none of that, and to say nothing while they try. **You will:** know whether a colleague can rerun your notebook, without your help, and get your result. **Time:** 10 minutes for you, and 10 for your colleague. **You need:** a folder holding a notebook that passes [Leave a notebook someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/leave-a-rerunnable-notebook/); a colleague who can [sign in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/); and their CyVerse username. ## Steps 1. Choose one result your notebook produces and write it down outside the folder: a row count, a total, or the last line a cell prints. You should see: one number or one line, in a note or a message draft. For the practice notebook, the count of rows in `readings` will do. 2. Share the folder with your colleague, with **Read** access, as in [Share a folder with a collaborator](https://idss-mesa.github.io/trainings/tutorials/share-a-folder/). You should see: **Shared · 1** in the folder's header. 3. Send your colleague three things and nothing more: your CyVerse username, the folder's name, and the sentence "Run the notebook from a fresh start and tell me what you get." Keep the result from step 1 to yourself. You should see: a message with no instructions in it. Anything else they need should already be in the folder. 4. Your colleague opens **Data Browser**, clicks **User Shared**, opens the folder named with your username, and then your folder. They download each file with the download button on its card, and upload the files into a folder of their own under **My Files**. They should see: the same files in a folder where the header says **Owner**. 5. Your colleague opens their copy in [MESA JupyterLab](https://idss-mesa.github.io/trainings/tutorials/launch-jupyterlab/), opens the notebook, and chooses **Kernel → Restart Kernel and Run All Cells…**. They should see: every code cell numbered in order, with no red error box. 6. Your colleague tells you three things: whether it ran without an error, the result they got, and every question they wanted to ask you on the way. You should see: their result equal to the one you wrote down in step 1. 7. Treat each question, and each difference, as something missing from the folder. Add it to the README or the notebook, then ask them to run it once more. You should see: a second run with no questions. ## Check it worked Your colleague ran the notebook in their own copy, got the result you wrote down before you shared the folder, and did not need to ask you anything. ## If it didn't **Your colleague cannot find your name under User Shared.** That list is refreshed every few minutes, so a folder shared a moment ago may not be there yet. It also shows 25 people to a page: they click **Next** until they reach your username. If it is still missing after ten minutes, open the share dialog and check that their username is under **Current Permissions**. ## Next - [Say where your input data came from](https://idss-mesa.github.io/trainings/tutorials/say-where-data-came-from/), which answers the question a colleague most often asks. - [Stop sharing a folder](https://idss-mesa.github.io/trainings/tutorials/stop-sharing-a-folder/), when the test is over. - Reference: [Managing data, "Share data"](https://idss-mesa.github.io/docs/portal/data/#share-data) and ["Upload, create, move, and delete"](https://idss-mesa.github.io/docs/portal/data/#upload-create-move-and-delete). *Not yet validated on the live portal. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15 from the MESA documentation.* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-leave-a-rerunnable-script/ --- type: Guide title: "Leave an R script someone else can rerun" description: "Put your checks in an R script that reads its own data, then run it from an empty workspace in MESA RStudio Geospatial to confirm it does not depend on anything you typed earlier." tags: [byte, p5, rstudio, r, reproducibility] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-16T00:00:00Z" } stale_after: "2027-05-16T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r resource: "https://stat.ethz.ch/R-manual/R-devel/library/base/html/source.html" title: "Read R Code from a File: source (R documentation)" author: "team:r-core" --- # Leave an R script someone else can rerun !!! warning "Draft: not yet validated" These steps were followed once inside MESA RStudio Geospatial on 2026-11-16 (R 4.6.2), by the AI assistant that drafted them. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). What you type in the **Console** stays in R's memory. A script that uses a table you loaded by hand runs for you and fails for the next person, who starts with nothing loaded. **You will:** have a script that runs from an empty workspace, top to bottom, without you. **Time:** 5 to 10 minutes. **You need:** the `mesa-practice` folder from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), in [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/map-points-in-rstudio/), with R's working folder still set to it. ## Steps 1. Choose **File → New File → R Script**. You should see: an empty editor tab named **Untitled1**, above the **Console**. 2. Type the script. It says what it needs, reads its own data, and names files without a folder in front: ```r # Checks on the practice rain-gauge data. # Needs gauges.csv and readings.csv in the same folder as this script. # Both are at https://idss-mesa.github.io/trainings/tutorials/practice-data/ readings <- read.csv("readings.csv", na.strings = "") gauges <- read.csv("gauges.csv") stopifnot(nrow(readings) == 152, anyDuplicated(gauges$gauge_id) == 0) print(table(readings$flag, useNA = "always")) cat(R.version.string, "\n") ``` You should see: the script in the editor. A path that starts at your own home folder works only for you; a bare file name works for anyone who has the file beside the script. 3. Choose **File → Save As...**. The **Save File** window opens on R's working folder, `mesa-practice`. Type `checks.R` as the file name and click **Save**. You should see: the tab renamed **checks.R**. 4. In the **Console**, empty R's memory: run `rm(list = ls())`. You should see: the **Environment** tab at the top right now empty. This is what the next person starts with. 5. In the **Console**, run `source("checks.R", echo = TRUE)`. You should see: the lines of the script, the flag counts (`S` 2, `` 150), and a last line that names the version of R. No line begins `Error`. R shortens the opening comment and the line after it to `[TRUNCATED]`; they still ran. 6. In the **Console**, run `list.files()`. You should see: `checks.R`, `gauges.csv`, and `readings.csv` among the names. The folder holds everything the script needs, so the folder is what you share. ## Check it worked Step 5 ran to the version line from an empty **Environment**. `stopifnot()` stayed silent, which means the table still has 152 rows and no gauge is listed twice. ## If it didn't **`Error: object '...' not found`.** The script uses something it never made, which was in memory only because you had typed it in the Console. Add the line that makes it above the line that failed, then repeat steps 4 and 5. **`cannot open file 'readings.csv': No such file or directory`.** R's working folder is not the folder that holds the script. Choose **Session → Set Working Directory → To Source File Location**, then repeat step 5. ## Next - [Record the software versions a result depends on](https://idss-mesa.github.io/trainings/tutorials/record-software-versions/) - Reference: [Managing data, "Share data"](https://idss-mesa.github.io/docs/portal/data/#share-data), for giving a colleague access to the folder. - The same task in Python: [Leave a notebook someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/leave-a-rerunnable-notebook/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-16 and followed there once that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-write-a-readme/ --- type: Guide title: "Write a README for a data folder, from RStudio" description: "Add a short README file to a folder in your Data Store, with the editor in MESA RStudio Geospatial, that says what the files are, where they came from, and who to ask." tags: [byte, p5, rstudio, documentation, data-store] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" --- # Write a README for a data folder, from RStudio !!! warning "Draft: not yet validated" These steps were followed once in MESA RStudio Geospatial on 2026-11-17 (R 4.6.2), by the AI assistant that drafted them, with a shorter text than the one in step 2. No person has yet followed them, so a screen may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). A folder of data without a description is a puzzle for the next person, and in six months that person is you. A README is a plain text file, kept with the data, that answers the first questions anyone asks. **You will:** have a `README.md` in a folder of your Data Store that describes what is in it. **Time:** 10 minutes. **You need:** the `mesa-practice` folder from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), or a folder of your own, in MESA RStudio Geospatial with R's working folder set to it. ## Steps 1. Choose **File → New File → Markdown File**. You should see: an empty editor tab named **Untitled1**, above the **Console**. 2. Type the description. Five short parts cover most folders: ```markdown # Practice rain-gauge data Synthetic data from the MESA Trainings tutorials. It describes no real place. ## Files - `gauges.csv`: one row per rain gauge (5 rows) - `readings.csv`: one row per gauge and day, July 2026 (152 rows) - `checks.R`: checks on both files; run it with `source("checks.R")` ## Source https://idss-mesa.github.io/trainings/tutorials/practice-data/ ## Notes - Orchard (G02) reports in centimetres; the other gauges report in millimetres. - Readings flagged `S` were marked suspect by the sensor. ## Contact Your name, your email address ``` You should see: the headings in colour in the editor. RStudio does not start the next bullet for you: type each `-` yourself. Leave out the `checks.R` line if your folder has no such script. 3. Click the save button, the disk at the left of the editor's toolbar. The **Save File** window opens on R's working folder. You should see: the folder's own files listed in the window, such as `gauges.csv`. 4. Type `README.md` as the file name and click **Save**. You should see: the tab renamed **README.md**. By convention that name is the one people look for first. 5. In the **Console**, confirm the file is in the folder: ```r file.exists("README.md") ``` You should see: `[1] TRUE`. ## Check it worked `README.md` is listed in the folder, in RStudio and in the portal's Data Browser, and a person who has never seen the folder could say from it what each file holds. ## If it didn't **The folder now holds `README.html` as well.** You clicked **Preview** in the editor's toolbar, which writes a web page beside the README and tries to open it in a new window. Nothing is lost. Remove the extra file with `file.remove("README.html")`. **A window asks about "visual editing mode".** You clicked **Visual**, above the text. That mode rewrites the file's Markdown in its own style. Click **Cancel** to stay with the text as you typed it. **`[1] FALSE` in step 5.** The file was saved somewhere else. Choose **File → Save As...**, go to your folder in the window, and save it there. ## Next - [Say where your input data came from](https://idss-mesa.github.io/trainings/tutorials/say-where-data-came-from/): the facts to put under **Source**. Its steps name JupyterLab's menus; in RStudio, open `README.md` from **File → Open File...** and save with the same disk button. - [Record the R and package versions a result depends on](https://idss-mesa.github.io/trainings/tutorials/r-record-software-versions/) - [Add metadata to a file or folder](https://idss-mesa.github.io/trainings/tutorials/add-metadata/), which makes the same facts searchable by tools. - The same task in JupyterLab: [Write a README for a data folder](https://idss-mesa.github.io/trainings/tutorials/write-a-readme/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17 and followed there once that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-record-software-versions/ --- type: Guide title: "Record the R and package versions a result depends on" description: "Write the R version and the version of every installed package to files beside your work in MESA RStudio Geospatial, so that a result can be traced to the software that produced it." tags: [byte, p5, rstudio, r, reproducibility, environment] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" - id: r-installed resource: "https://stat.ethz.ch/R-manual/R-devel/library/utils/html/installed.packages.html" title: "Find Installed Packages: installed.packages (R documentation)" author: "team:r-core" - id: r-session resource: "https://stat.ethz.ch/R-manual/R-devel/library/utils/html/sessionInfo.html" title: "Collect Information About the Current R Session: sessionInfo (R documentation)" author: "team:r-core" --- # Record the R and package versions a result depends on !!! warning "Draft: not yet validated" The code on this page was run in MESA RStudio Geospatial on 2026-11-17 (R 4.6.2), by the AI assistant that drafted it, and gave the results quoted in the steps. No person has yet followed the steps. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). The software in a MESA app changes when the app is rebuilt. A number you computed today may not come out the same next year, and without a record you cannot tell whether the data or the software changed. **You will:** have three small files beside your work that say which R and which package versions it ran on. **Time:** 5 minutes. **You need:** the `mesa-practice` folder from [Load a file from your Data Store in RStudio](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/), or a folder of your own, in MESA RStudio Geospatial with R's working folder set to it. ## Steps 1. In the **Console**, check the R version: ```r R.version.string ``` You should see: one line, such as `[1] "R version 4.6.2 (2026-10-29)"`. 2. Write every installed package and its version to a file: ```r pkgs <- as.data.frame(installed.packages()[, c("Package", "Version")], row.names = FALSE) write.csv(pkgs, "r-packages.csv", row.names = FALSE) ``` You should see: no output, and `pkgs` in the **Environment** tab at the top right. 3. Count what was recorded: ```r nrow(pkgs) ``` You should see: a few hundred, one row for each package. In our test, `[1] 288`. 4. Look up the packages your work loads. For the practice tutorials: ```r pkgs[pkgs$Package %in% c("sf", "duckdb", "terra"), ] ``` You should see: one row for each, with its version. In our test, `duckdb` 2.0.0, `sf` 1.1-3 and `terra` 1.9-50. The number at the start of each row is its place in the list. 5. Record the session: the operating system, and the packages loaded right now. ```r writeLines(capture.output(sessionInfo()), "r-session.txt") ``` You should see: no output. Run this at the end of your work, when everything the work uses has been loaded. 6. Write a one-line note that ties the files together and dates them: ```r writeLines(paste0(R.version.string, ", packages in r-packages.csv, recorded ", Sys.Date()), "r-environment.txt") readLines("r-environment.txt") ``` You should see: the note. In our test, `[1] "R version 4.6.2 (2026-10-29), packages in r-packages.csv, recorded 2026-11-17"`. ## Check it worked `list.files(pattern = "^r-")` names `r-environment.txt`, `r-packages.csv` and `r-session.txt`, and step 4 shows a version for each package your work loads. ## If it didn't **Step 4 prints `[1] Package Version` and `<0 rows>`.** None of the names matched what is installed. Names are case-sensitive: search with `pkgs[grepl("duck", pkgs$Package, ignore.case = TRUE), ]` and use the spelling it shows. ## Next - These files record the software; they do not rebuild it. To run old work again you need an app with the same versions, or to install them yourself. - Record again whenever a result goes into a report: the date in `r-environment.txt` says which run the record belongs to. - [Leave an R script someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/r-leave-a-rerunnable-script/) - [Write a README for a data folder, from RStudio](https://idss-mesa.github.io/trainings/tutorials/r-write-a-readme/), and mention these three files in it. - The same task in Python: [Record the software versions a result depends on](https://idss-mesa.github.io/trainings/tutorials/record-software-versions/). *Not yet validated by a person in MESA RStudio Geospatial. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17; the code was run there that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/tutorials/r-hand-over-and-rerun/ --- type: Guide title: "Hand your folder to a colleague and have them rerun it, in R" description: "Test whether your R work can be repeated without you: share the folder, have a colleague copy it and run the script in a new RStudio session, and compare their result with the one you wrote down." tags: [byte, p5, rstudio, r, reproducibility, sharing] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-17T00:00:00Z" } stale_after: "2027-05-17T00:00:00Z" sources: - id: docs-data resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" - id: docs-rstudio resource: "https://idss-mesa.github.io/docs/apps/rstudio/" title: "MESA RStudio Geospatial" author: "team:idss-mesa" --- # Hand your folder to a colleague and have them rerun it, in R !!! warning "Draft: not yet validated" Nobody has yet followed this tutorial from start to finish: it needs two accounts. Only step 5 was run, in MESA RStudio Geospatial on 2026-11-17 (R 4.6.2), by the AI assistant that drafted this page. The rest comes from the MESA documentation. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). You cannot tell from the inside whether your folder holds everything. You know where the files are, what to run, and what the answer should be. The test is to give the folder to someone who knows none of that, and to say nothing while they try. **You will:** know whether a colleague can rerun your script, without your help, and get your result. **Time:** 10 minutes for you, and 10 for your colleague. **You need:** a folder holding a script that passes [Leave an R script someone else can rerun](https://idss-mesa.github.io/trainings/tutorials/r-leave-a-rerunnable-script/); a colleague who can [sign in to the MESA Portal](https://idss-mesa.github.io/trainings/tutorials/sign-in/); and their CyVerse username. ## Steps 1. Choose one result your script prints and write it down outside the folder: a row count, a total, or its last line. You should see: one number or one line, in a note or a message draft. For `checks.R`, the two flag counts will do: `S` 2, `` 150. 2. Share the folder with your colleague, with **Read** access, as in [Share a folder with a collaborator](https://idss-mesa.github.io/trainings/tutorials/share-a-folder/). You should see: **Shared · 1** in the folder's header. 3. Send your colleague three things and nothing more: your CyVerse username, the folder's name, and the sentence "Run the script in a new RStudio session and tell me what you get." Keep the result from step 1 to yourself. You should see: a message with no instructions in it. Anything else they need should already be in the folder. 4. Your colleague opens **Data Browser**, clicks **User Shared**, opens the folder named with your username, and then your folder. They download each file with the download button on its card, and upload the files into a folder of their own under **My Files**. They should see: the same files in a folder where the header says **Owner**. 5. Your colleague starts [MESA RStudio Geospatial](https://idss-mesa.github.io/trainings/tutorials/r-load-a-file/) and, in the **Console**, goes to their copy and runs the script, with their own username and folder name in the first line: ```r setwd("~/data-store/home//mesa-practice") source("checks.R", echo = TRUE) ``` They should see: the lines of the script and what each prints, with no line that begins `Error`. A session that has just started has nothing in its **Environment**, so the script gets no help from earlier work. 6. Your colleague tells you three things: whether it ran without an error, the result they got, and every question they wanted to ask you on the way. You should see: their result equal to the one you wrote down in step 1. 7. Treat each question, and each difference, as something missing from the folder. Add it to the README or to the comment at the top of the script, then ask them to run it once more. You should see: a second run with no questions. ## Check it worked Your colleague ran the script in their own copy, got the result you wrote down before you shared the folder, and did not need to ask you anything. ## If it didn't **Your colleague cannot find your name under User Shared.** That list is refreshed every few minutes, so a folder shared a moment ago may not be there yet. It also shows 25 people to a page: they click **Next** until they reach your username. If it is still missing after ten minutes, open the share dialog and check that their username is under **Current Permissions**. **`cannot open file 'checks.R'`.** The folder in `setwd()` is not the one that holds the copy. Your colleague corrects the path. ## Next - [Say where your input data came from](https://idss-mesa.github.io/trainings/tutorials/say-where-data-came-from/), which answers the question a colleague most often asks. - [Stop sharing a folder](https://idss-mesa.github.io/trainings/tutorials/stop-sharing-a-folder/), when the test is over. - Reference: [Managing data, "Share data"](https://idss-mesa.github.io/docs/portal/data/#share-data) and ["Upload, create, move, and delete"](https://idss-mesa.github.io/docs/portal/data/#upload-create-move-and-delete). - The same task in Python: [Hand your folder to a colleague and have them rerun it](https://idss-mesa.github.io/trainings/tutorials/hand-over-and-rerun/). *Not yet validated by a person. Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-17 from the MESA documentation; step 5 was run in MESA RStudio Geospatial that day (R 4.6.2).* ---8<--- https://idss-mesa.github.io/trainings/contributing/ --- type: Guide title: "Contribute a tutorial" description: "How to report a problem with a MESA tutorial, fix one, write a new one, add it to a learning pathway, write a self-check, and validate a tutorial on the live portal." tags: [contributing, tutorials, pathway, self-check] status: draft generated: { by: "claude-code/2.1.321", at: "2026-11-14T00:00:00Z" } sources: - id: repo resource: "https://github.com/idss-mesa/trainings" title: "idss-mesa/trainings repository" author: "team:idss-mesa" --- # Contribute a tutorial The tutorials live as Markdown files in the [idss-mesa/trainings](https://github.com/idss-mesa/trainings) repository[^repo]. Anyone who can write Markdown can improve them. ## Report a problem If a step did not match what you saw, [open an issue](https://github.com/idss-mesa/trainings/issues) with the tutorial's title, the step number, what the page said, and what you saw instead. A screenshot helps. Leave passwords, tokens, and private data out of it. ## Fix or write a tutorial 1. Fork the repository, or create a branch if you are a member of the organization. 2. For a new tutorial, copy the [tutorial template](https://idss-mesa.github.io/trainings/template/) into `docs/tutorials/.md` and follow its rules. One task per tutorial, up to about 600 words. 3. Add the page in two places: the `nav` list in `zensical.toml`, and a bullet in `docs/tutorials/index.md` whose description matches the page's `description`. 4. Add a dated entry to `docs/log.md`. 5. To put the tutorial in a learning pathway, add its file name to one `tutorials:` list in `data/pathways.yml`. Without that it is still listed under its point on [Every tutorial, by pathway point](https://idss-mesa.github.io/trainings/pathway/). 6. Check it locally: ```bash pip install zensical pyyaml python scripts/okf_validate.py docs # front matter is complete python scripts/gen_pathways.py # regenerate the pathway pages python scripts/gen_llms_txt.py # regenerate llms.txt and llms-full.txt zensical build --clean --strict # the site builds with no broken links zensical serve # preview at http://localhost:8000 ``` 7. Commit the regenerated files with your change, and open a pull request. Changes reach the site only through a reviewed pull request. ## Add a tutorial to a pathway A [learning pathway](https://idss-mesa.github.io/trainings/pathways/) is a short route through the tutorials towards one goal. The pathways are described in one file, `data/pathways.yml`, and the pages are written from it by a script. Never edit `docs/pathways/` or `docs/pathway.md` by hand. 1. Give the tutorial its pathway tag, `p1` to `p5`, in its front matter, and a `**Time:** N minutes.` line. The pathway pages read its title, point, and time from the tutorial itself. 2. In `data/pathways.yml`, find the pathway and the stage for the tutorial's point, and add the file name, without `.md`, to that stage's `more:` list: ```yaml - point: p2 tutorials: - practice-data - load-a-file more: - your-new-tutorial ``` `tutorials:` holds the essentials, the few a reader cannot do without, and `more:` holds what to take with more time. Pathways are kept short on purpose: the essentials of a pathway may not add up to more than `essentials_minutes`, now 25. Add to `tutorials:` only if a reader would be stuck without the tutorial, and expect to move another one to `more:` to make room. 3. Run `python scripts/gen_pathways.py` and commit what it writes. It stops with a message if a name matches no tutorial, if a tutorial sits under the wrong point, or if the essentials run over the limit. Readers can shorten a pathway further by answering "Where are you starting?" on the [pathways page](https://idss-mesa.github.io/trainings/pathways/). Two lists under `tailoring:` in the same file drive that: `foundations`, the point 2 tutorials that later ones build on, and `in_r`, which names the R tutorial that replaces a Python one. A new R counterpart is one line there. A tutorial that is in no pathway still appears under its point on [Every tutorial, by pathway point](https://idss-mesa.github.io/trainings/pathway/). To choose its place there, add it to a group under `by_point:` in the same file. A new pathway is a new entry under `pathways:` and one line in the `nav` list in `zensical.toml`. Name it for what the reader wants to do, never for a numbered session or a date. ## Write a self-check A [self-check](https://idss-mesa.github.io/trainings/pathways/self-checks/) is one short question a reader tries after a tutorial. It lives under `checks:` in `data/pathways.yml`, not in the tutorial, so the tutorial keeps its six parts. ```yaml rows-without-repeats: tutorial: count-records-per-day ask: Remove exact repeats with `drop_duplicates()`. How many rows remain? answer: 151 how: len(readings.drop_duplicates()) verify: python: | len(readings.drop_duplicates()) right: One row, G03 on 5 July, is written twice, so 152 becomes 151. slips: "152": That is the table as loaded. One row for G03 is written twice. otherwise: Count the rows of `readings.drop_duplicates()`. ``` 1. **Ask for something the tutorial does not print.** Choose a number the reader gets by a small change to what the tutorial taught. If the answer is on the page, it can be read off without doing the task. 2. **Give a number**, or for an answer in two parts, a list of `options:` with the right one repeated as `answer:`. List the options in a plain order, such as by name or by size, not with the right one first. The site will not build if the right answer sits in the same place in most self-checks. 3. **Write `verify:` code** whose last line gives the answer from the practice data. `pandas` as `pd`, `duckdb`, and the tables `readings`, `august`, `gauges`, `sites`, and `obs` are already loaded. For an R tutorial use `r:` with one expression. The site will not build if the code and the answer disagree. 4. **Name the likely slips.** For each wrong answer a careful person might give, write one sentence under `slips:` that says what went wrong, and a general hint under `otherwise:`. Write `right:` as the one sentence that explains the answer. 5. **A question about a portal screen has no `verify:`.** It is shown as "not machine-checked". Write one only for a tutorial that has been followed on the live portal, and take the answer from that tutorial's own text. 6. To let readers skip a point by answering its questions, list their names under that point's `skip_check:`. 7. Check it: ```bash pip install pandas==3.1.1 duckdb==2.0.0 pyyaml python scripts/gen_pathways.py # writes the self-checks page python scripts/check_self_checks.py # the answers agree with the data ``` Self-check answers are public and are for a reader's own use. Answer keys for training sessions do not belong in this repository. ## What belongs here Only what a participant or a MESA user should read. - **Yes:** single-task tutorials, and pages that help readers find and use them. - **No:** answer keys, facilitator notes, session plans, review checklists, or correspondence with partners. Those are kept elsewhere. - **No:** features that the public [MESA documentation](https://idss-mesa.github.io/docs/) does not describe. Document the feature there first, then write the tutorial. - **Never:** usernames, passwords, tokens, or keys, including in screenshots. ## Validate a tutorial A tutorial is a draft until someone other than its author has followed it from start to finish on the live portal. To validate one: 1. Follow every step exactly as written, in a fresh browser session. 2. At each step, compare what you see with "You should see". Note every difference, however small: a button with another name, a screen in another order. 3. Do the check at the end, and try the "If it didn't" slip on purpose to confirm its symptom and its fix. 4. Open a pull request that corrects the text and replaces the last line with the date, your name, and what you tested against (portal, app, and image or version). A maintainer then removes the draft notice, sets `status: stable`, and records the validation. Only a human maintainer adds the `verified:` key. ## If you used AI Say so. Put the tool in `generated.by`, and keep the "Drafted with AI assistance" wording in the tutorial's last line; [How AI was used](https://idss-mesa.github.io/trainings/about/ai-disclosure/) explains why. You are responsible for what you submit: run every step and every code block yourself before opening the pull request. ## License of contributions By contributing you agree that your text and images are released under [CC BY 4.0](https://idss-mesa.github.io/trainings/about/license/) and any code under the BSD 3-Clause license, the same terms as the rest of the site. [^repo]: https://idss-mesa.github.io/trainings/idss-mesa/trainings repository, . ---8<--- https://idss-mesa.github.io/trainings/template/ --- type: Reference title: "Tutorial template" description: "The template every MESA tutorial follows: the front matter, the six fixed parts, the draft notice, and the validation line; and the rules for an explainer." tags: [contributing, template, byte] status: draft generated: { by: "claude-code/2.1.224", at: "2026-11-11T00:00:00Z" } sources: - id: quickbytes resource: "https://github.com/UNM-CARC/QuickBytes" title: "UNM CARC QuickBytes" author: "team:unm-carc" - id: docs-agents resource: "https://github.com/idss-mesa/docs/blob/main/AGENTS.md" title: "Agent guide — MESA documentation (page front matter)" author: "team:idss-mesa" --- # Tutorial template A MESA tutorial, called a *byte*, is one short page that gets a reader through one task. The format is modelled on UNM CARC's QuickBytes[^quickbytes], and the front matter is the one the MESA documentation uses for every page[^docs-agents]. Copy the block below into a new file under `docs/tutorials/`, named for the task in lower case with hyphens (`share-a-folder.md`), and replace everything in angle brackets. [Contribute a tutorial](https://idss-mesa.github.io/trainings/contributing/) explains the rest. ## The template ````markdown --- type: Guide title: "" description: "" tags: [byte, , ] status: draft generated: { by: "", at: "T00:00:00Z" } stale_after: "T00:00:00Z" sources: - id: docs resource: "" title: "" author: "team:idss-mesa" --- # !!! warning "Draft: not yet validated" This tutorial was written from the MESA documentation. Nobody has yet followed it from start to finish on the live portal, so a screen name or a step may differ. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). **You will:** . **Time:** <5-10> minutes. **You need:** . ## Steps 1. You should see: . 2. <...> You should see: <...>. ## Check it worked ## If it didn't **.** ## Next - - Reference: *Not yet validated on the live portal. Drafted with [AI assistance](../about/ai-disclosure.md) on from .* ```` ## Rules 1. **One task, named by its verb.** "Launch JupyterLab with your Data Store mounted", not "JupyterLab". If the title needs "and" to join two tasks, write two tutorials. 2. **Short.** Up to about 600 words and seven steps; five to ten minutes for someone doing it for the first time. 3. **Six fixed parts, in this order:** what you will have, what you need, the steps, how to check it worked, what to do if it did not, and where to go next. 4. **Every step says what you should see.** A step without a visible result cannot be validated. 5. **One check at the end** that tells success from failure without judgment: a file listed, a count, a name on screen. 6. **One "If it didn't":** the single most likely slip, described by its symptom. If you need more than one, the tutorial covers too much. 7. **Link, don't repeat.** Name the MESA documentation page the tutorial draws on, and the tutorials before and after it. Reuse the documentation's screenshots by linking to them; a screenshot supports a step and never replaces it, and always has a text description. 8. **Names as the screen shows them, in bold.** Anything the reader types goes in a code block that can be copied. 9. **No credentials, ever.** Use a placeholder and one line on where readers get their own. 10. **Stands on its own.** A tutorial never assumes a training session, a group, or a schedule. 11. **Data is public, synthetic, or authorized,** with its attribution line when a tutorial uses a dataset. 12. **Say when AI helped.** If an AI assistant drafted or revised any part of the tutorial, its last line says so and links to [How AI was used](https://idss-mesa.github.io/trainings/about/ai-disclosure/), and `generated.by` names the tool. Write "Drafted " with no mention of AI only when a person wrote all of it. ## Front matter | Field | What goes in it | |---|---| | `type` | `Guide` for a tutorial | | `title`, `description` | The task, verb first, and one plain sentence. The description becomes the entry in the tutorial list and in `llms.txt`. | | `tags` | Always `byte`, then one pathway tag (`p1` orient and navigate, `p2` run and understand, `p3` query and connect, `p4` explore and verify, `p5` preserve and share), then the feature | | `status` | `draft` until someone other than the author has followed the tutorial from start to finish on the live platform, then `stable` | | `generated` | Who or what wrote it and when: `human:` for a person, `/` for an AI agent or tool | | `stale_after` | The review date, six months out. A portal or app release that changes a named screen brings it forward. | | `sources` | The documentation pages the tutorial draws on | There is deliberately no `verified:` key in the template. Only a human maintainer adds it, after validation. ## The draft notice and the validation line A tutorial that has not been validated carries the **Draft: not yet validated** notice under its title and ends with the *Not yet validated* line. When it has been validated, the maintainer removes the notice, sets `status: stable`, and replaces the last line with: ```markdown *Validated by on .* ``` If AI helped write the tutorial, that statement stays after validation: ```markdown *Drafted with [AI assistance](../about/ai-disclosure.md). Validated by on .* ``` A data tutorial, one that teaches a technique on the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/), words both a little differently, because its code can be run before anyone tries it in a MESA app. Its notice says where the code was run, and its last line reads *Not yet validated in MESA JupyterLab*. Copy both from an existing data tutorial such as [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/). ## Explainers An *explainer* is the other kind of page: it explains one idea and gives no steps to follow. It lives under `docs/explainers/`, has `type: Explainer` and the tag `explainer`, and otherwise carries the same front matter as a tutorial: `status: draft`, `sources` naming every page it rests on, and never `verified:`. | Rule | Detail | |---|---| | Length | 500 words or fewer; one idea | | Parts, in this order | **The idea in one sentence** · **Why it matters for your result** · **How it works** (one figure or one small table at most) · **What it looks like in MESA** (only what the documentation describes) · **A common mistake** · **Check your understanding** (one question, with the answer folded away) · **Next** (one tutorial) | | Never | Steps to follow (that is a tutorial); product comparisons; claims about what a model can do; a training session | | Attribution | Where an idea is adapted from another course, a line at the foot names the creator, the link, the revision, the license, and what changed | | AI disclosure | The last line says when AI helped draft it, as for a tutorial | | Review | A second person reads it against the MESA documentation before it leaves draft | [^quickbytes]: https://idss-mesa.github.io/trainings/UNM CARC QuickBytes, . [^docs-agents]: https://idss-mesa.github.io/trainings/Agent guide, MESA documentation, . ---8<--- https://idss-mesa.github.io/trainings/explainers/what-an-agent-is/ --- type: Explainer title: "What an agent is, and is not" description: "An agent is a language model that calls tools in a loop and chooses its own next step; this page sets it beside a chat model and a fixed pipeline." tags: [explainer, ai-agents, p4] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" --- # What an agent is, and is not !!! warning "Draft: not yet reviewed" This explainer was drafted with an AI assistant. Nobody has yet read it against the MESA documentation. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). ## The idea in one sentence An agent is a language model that can call tools in a loop and decide the next step itself. ## Why it matters for your result What an agent can reach decides what it can get wrong. A model that only writes text can mislead you. A model that can also run commands can change a file, and can base an answer on something it fetched without your seeing it. ## How it works Three things are often called by the same name. The difference between them is who decides what happens next. | | Who decides the next step | What that looks like | |---|---|---| | A chat model | You | It writes an answer. You read it and choose what to do with it. | | A fixed pipeline | Whoever wrote it, in advance | The same steps run in the same order every time. | | An agent | The model, after each result | It calls a tool, reads what came back, and chooses whether to call another. | ## What it looks like in MESA - Every MESA featured app includes AI agents as command-line tools, which you start by typing a command in a terminal[^docs-agents]. - After you run `cyverse-login`, the agents act as you, with access to your home folder and to what is shared with you. - Without it, they have anonymous, read-only access to public data. - The apps contain no keys for a language model: each person connects their own. ## A common mistake Treating a fluent answer as a retrieved one. An agent writes the same confident sentence whether a tool returned the fact or not. How well it reads tells you nothing about where it came from. ## Check your understanding Which of these is an agent? - A chatbot that writes a query for you to run - A script that runs the same three queries every night - A program that runs a query, reads the result, and decides whether to run another ??? success "Answer" **The third.** It alone chooses its next step from what came back. In the first you decide what to do with the query, and in the second the steps were fixed when the script was written. ## Next - [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/) *Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15. No person has yet reviewed this page.* *Adapted from [AI Automation and Agents](https://tyson-swetnam.github.io/AI-Automation-and-Agents/), Center for Advanced Research Computing, University of New Mexico, 2026 (developed at the Arizona Institute for Artificial Intelligence, University of Arizona), by Carlos Lizárraga-Celaya, Michelle Yung, Michele Cosi, and Tyson Swetnam: [Guest Lecture: Agentic AI Loops](https://tyson-swetnam.github.io/AI-Automation-and-Agents/guest-lectures/agentic-ai-loops/) and [Guest Lecture: Say What You Mean](https://tyson-swetnam.github.io/AI-Automation-and-Agents/guest-lectures/say-what-you-mean/). [Revision a65855c](https://github.com/tyson-swetnam/AI-Automation-and-Agents/tree/a65855c), [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Changes: the ideas are restated and shortened in MESA's words, with MESA examples added; no text is copied.* [^docs-agents]: https://idss-mesa.github.io/trainings/explainers/AI agents in the MESA apps, . ---8<--- https://idss-mesa.github.io/trainings/explainers/tools-and-mcp/ --- type: Explainer title: "How an agent reaches data: tools and MCP" description: "An AI agent can only do what its tools let it do, and MCP is the common way those tools are offered to it; this page names the tool servers in the MESA apps." tags: [explainer, ai-agents, mcp, p4] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-18T00:00:00Z" } stale_after: "2027-05-18T00:00:00Z" sources: - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" - id: docs-mesa-mcp resource: "https://idss-mesa.github.io/docs/servers/mesa-mcp/" title: "mesa-mcp" author: "team:idss-mesa" - id: mcp-spec resource: "https://modelcontextprotocol.io/specification/2025-11-25" title: "Model Context Protocol specification, revision 2025-11-25: Architecture, Tools" author: "team:modelcontextprotocol" --- # How an agent reaches data: tools and MCP !!! warning "Draft: not yet reviewed" This explainer was drafted with an AI assistant from the MCP specification and the MESA documentation. The assistant saw the four server names in a MESA JupyterLab terminal on 2026-11-18. Nobody has yet read the page against either source. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). ## The idea in one sentence An agent can only do what its tools let it do, and the Model Context Protocol (MCP) is the common way tools are offered to it. ## Why it matters for your result Knowing the tools tells you what an answer could have been based on. If no tool can read a file, nothing the agent says about that file came from the file. ## How it works A language model on its own produces text. To list a folder or read a table, something else has to do the work and hand back the result. MCP is an agreed way to set that up[^mcp-spec]. | Part | What it is | |---|---| | Server | A program that offers tools. It runs beside the agent or somewhere else. | | Tool | One thing a server can do. It has a name, a description, and the inputs it needs. | | Call | The agent's request to run one tool with given inputs. The server does it and returns the result. | The model reads the list of tools and picks one from its **description**. It does not look inside the tool. A tool with a vague description gets called at the wrong time, or not at all. ## What it looks like in MESA Every MESA app registers the same four servers for its agents[^docs-agents]: | Server | What its tools are for | |---|---| | `irods` | The Data Store: list, read, write, and move files and folders | | `mesa` | The Data Store again, plus metadata and ontology terms[^docs-mesa-mcp] | | `formation` | The Discovery Environment: list and launch apps, check on an analysis | | `filesystem` | Files inside the running app | The terminal's welcome text lists them by these names. Until you run `cyverse-login`, the Data Store tools read public data only. `formation` needs a sign-in of its own. ## A common mistake Assuming the agent "has access to MESA" as a whole. It has these tools, with your sign-in or without it, and nothing else. It cannot see the portal page you are looking at. ## Check your understanding You ask an agent how many CPU hours you have left. It answers at once, with a number, and the run shows no tool call. What do you know about the number? ??? success "Answer" **It did not come from MESA.** Nothing was called, so nothing was looked up. The number is [recalled, not retrieved](https://idss-mesa.github.io/trainings/explainers/recalled-or-retrieved/). Read your hours in the portal: [Check your CPU hours and storage](https://idss-mesa.github.io/trainings/tutorials/check-your-usage/). ## Next - [Sign in and start an AI agent in a MESA app](https://idss-mesa.github.io/trainings/tutorials/start-an-ai-agent/) *Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-18. No person has yet reviewed this page.* [^docs-agents]: https://idss-mesa.github.io/trainings/explainers/AI agents in the MESA apps, . [^docs-mesa-mcp]: https://idss-mesa.github.io/trainings/explainers/mesa-mcp, . [^mcp-spec]: https://idss-mesa.github.io/trainings/explainers/Model Context Protocol specification, revision 2025-11-25, . ---8<--- https://idss-mesa.github.io/trainings/explainers/recalled-or-retrieved/ --- type: Explainer title: "Recalled or retrieved" description: "A figure in an AI agent's answer either came back from a tool call or came from the model's memory, and only the first can be checked against your data." tags: [explainer, ai-agents, verification, p4] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" - id: practice-data resource: "https://idss-mesa.github.io/trainings/tutorials/practice-data/" title: "Practice data: five invented rain gauges" author: "team:idss-mesa" --- # Recalled or retrieved !!! warning "Draft: not yet reviewed" This explainer was drafted with an AI assistant. Nobody has yet read it against the MESA documentation. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). ## The idea in one sentence A figure in an answer either came back from a tool call or came from the model's memory, and only the first can be checked against your data. ## Why it matters for your result Memory produces plausible numbers with no source. A retrieved figure has a call behind it that you can run again. A recalled one has nothing behind it but the sentence. ## How it works Take one answer about the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/)[^practice-data], with two figures in it: > Observatory recorded 251.1 mm of rain in July, well above the 60 mm that is usual for > the region. | Figure | Kind | How you can tell | |---|---|---| | 251.1 mm | Retrieved | A call in the run summed the readings and returned this number. Run it again and you get it again. | | 60 mm | Recalled | No call returned it. The data hold one month from invented gauges, so nothing in them says what is usual. | Both figures are stated in the same voice. Only the record of the run tells them apart. ## What it looks like in MESA The agents in the MESA apps do their work by calling tools: the MCP servers that are registered in every app[^docs-agents]. A figure is retrieved when one of those calls returned it. ## A common mistake Checking that the number is reasonable instead of where it came from. A recalled figure is usually reasonable. That is what makes it hard to catch. ## Check your understanding An answer says: "G05's largest reading was 180.0 mm, a new record for the station." The run shows one call, which returned the row holding 180.0. Which part is retrieved? ??? success "Answer" **Only the 180.0 mm.** The call returned that reading. Nothing in the run compared it with earlier years, and the file holds a single month, so "a new record" came from nowhere you can check. ## Next - [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/) *Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15. No person has yet reviewed this page.* *Adapted from [AI Automation and Agents](https://tyson-swetnam.github.io/AI-Automation-and-Agents/), Center for Advanced Research Computing, University of New Mexico, 2026 (developed at the Arizona Institute for Artificial Intelligence, University of Arizona), by Carlos Lizárraga-Celaya, Michelle Yung, Michele Cosi, and Tyson Swetnam: [Module 2 Reading Guides, Reading Guide 3](https://tyson-swetnam.github.io/AI-Automation-and-Agents/modules/module-2/reading-guides/#reading-guide-3) and [Guest Lecture: Agentic AI Loops](https://tyson-swetnam.github.io/AI-Automation-and-Agents/guest-lectures/agentic-ai-loops/). [Revision a65855c](https://github.com/tyson-swetnam/AI-Automation-and-Agents/tree/a65855c), [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Changes: the ideas are restated; the worked example is MESA's own, on the practice data; no text is copied.* [^docs-agents]: https://idss-mesa.github.io/trainings/explainers/AI agents in the MESA apps, . [^practice-data]: https://idss-mesa.github.io/trainings/explainers/Practice data: five invented rain gauges, . ---8<--- https://idss-mesa.github.io/trainings/explainers/reading-what-an-agent-did/ --- type: Explainer title: "Reading what an agent did" description: "The record of an AI agent's calls can be read like a lab notebook, and it goes wrong in five recognisable ways, each with a tell." tags: [explainer, ai-agents, verification, trace-card, p4] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" - id: practice-data resource: "https://idss-mesa.github.io/trainings/tutorials/practice-data/" title: "Practice data: five invented rain gauges" author: "team:idss-mesa" --- # Reading what an agent did !!! warning "Draft: not yet reviewed" This explainer was drafted with an AI assistant. Nobody has yet read it against the MESA documentation. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). ## The idea in one sentence The record of an agent's calls can be read like a lab notebook, and it fails in a small number of recognisable ways. ## Why it matters for your result An answer can be wrong while every sentence in it sounds right. The record of what the agent ran, and what came back, is where the fault shows. ## How it works Read the run line by line and look for five things. | Failure | The tell | |---|---| | The wrong tool or query | What the call asks for is not what the question asked for | | A malformed call | A call comes back with an error, and an answer follows anyway | | A result misread | The call and its result are right, but the answer says they mean something else: a unit or a column's meaning that was never looked up | | Stopping early | Every check made is right, and something in a result that does not add up is never followed | | A fact from memory | A figure in the answer appears in no result | ## What it looks like in MESA The agents in the MESA apps run in a terminal and work by calling the MCP servers registered in every app[^docs-agents]. Those calls, and what they returned, are the record to read. ## A common mistake Reading only the final answer. It is the one part of the run that the agent wrote to be believed. ## Check your understanding A run on the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/)[^practice-data]. Which failure is it? 1. The question: "On how many days in July did G04 record rain?" 2. The agent says: "I will count G04's readings." 3. The call returns: 31. 4. The agent answers: "G04 recorded rain on 31 days in July." ??? success "Answer" **The wrong query.** The call counted G04's rows, one for every day, and many of those rows record no rain. Counting only the rows with a value above zero gives 14. The tell is at line 2: the plan already asks a different question. ## Next - [Trace cards](https://idss-mesa.github.io/trainings/trace-cards/): six short runs to judge, with answers. *Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15. No person has yet reviewed this page.* *Adapted from [AI Automation and Agents](https://tyson-swetnam.github.io/AI-Automation-and-Agents/), Center for Advanced Research Computing, University of New Mexico, 2026 (developed at the Arizona Institute for Artificial Intelligence, University of Arizona), by Carlos Lizárraga-Celaya, Michelle Yung, Michele Cosi, and Tyson Swetnam: [Module 2 Reading Guides, Reading Guide 3](https://tyson-swetnam.github.io/AI-Automation-and-Agents/modules/module-2/reading-guides/#reading-guide-3). [Revision a65855c](https://github.com/tyson-swetnam/AI-Automation-and-Agents/tree/a65855c), [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Changes: the ideas are restated and shortened; the five example runs are MESA's own; no text is copied.* [^docs-agents]: https://idss-mesa.github.io/trainings/explainers/AI agents in the MESA apps, . [^practice-data]: https://idss-mesa.github.io/trainings/explainers/Practice data: five invented rain gauges, . ---8<--- https://idss-mesa.github.io/trainings/explainers/when-to-stop-and-ask/ --- type: Explainer title: "When to stop and ask" description: "Some steps should not be left to an AI agent until a person has looked: the ones that write, delete, share or spend, and the ones whose result you could not check." tags: [explainer, ai-agents, permissions, verification, p4] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-22T00:00:00Z" } stale_after: "2027-05-22T00:00:00Z" sources: - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" --- # When to stop and ask !!! warning "Draft: not yet reviewed" This explainer was drafted with an AI assistant. Nobody has yet read it against the MESA documentation. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). ## The idea in one sentence Some steps should wait for a person: the ones that cannot be taken back, and the ones whose result you could not check. ## Why it matters for your result A wrong answer costs you a check. A wrong action can cost a file, a shared folder, or hours of your allocation, and the agent's report afterwards may still read as a success. ## How it works Sort each step an agent proposes by what it does. | The step | Why it waits | Look at first | |---|---|---| | Writes over a file | The earlier content may be gone | Which file, and whether a copy exists | | Deletes or moves | Someone may rely on that path | Exactly what, and where it goes | | Shares, or changes who can read | It reaches other people | Who gains access, and to what | | Starts an analysis | It spends your allocation | What will run, and for how long | | Gives a result you could not check | You would be trusting, not verifying | The check you would run | Reading, listing, counting and drafting can run freely: a mistake there changes nothing. ## What it looks like in MESA After you run `cyverse-login` in an app, the agents act as you, with access to your home folder and to what is shared with you. Without it they have anonymous, read-only access to public data[^docs-agents]. So a signed-in agent can change whatever you can change. With the further Formation sign-in, an agent can also be asked to launch an analysis in the Discovery Environment[^docs-agents]. The documentation does not say which steps each agent asks about before it acts. ## A common mistake Approving a step because the ten before it were fine. The run so far says nothing about the next step. ## Check your understanding An agent, signed in as you, is tidying a folder of results. It proposes four steps. Which should wait for you? 1. List the files in the folder. 2. Count the rows in each CSV file. 3. Delete the files whose names end `-old`. 4. Share the folder with your working group. ??? success "Answer" **Steps 3 and 4.** Listing and counting change nothing. Before step 3, read the names it would delete: a pattern can match more than you meant. Before step 4, confirm who gains access, and to what. ## Next - [Check what an agent may change before you let it](https://idss-mesa.github.io/trainings/tutorials/check-what-an-agent-may-change/): find out what your agent does without asking, in a folder that holds nothing you care about. *Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-22. No person has yet reviewed this page.* [^docs-agents]: https://idss-mesa.github.io/trainings/explainers/AI agents in the MESA apps, . ---8<--- https://idss-mesa.github.io/trainings/trace-cards/how-to-use/ --- type: Reference title: "How to use the trace cards" description: "What a trace card is, how to work through one, and the kinds of failure to look for when you read what an AI agent did." tags: [trace-card, ai-agents, verification] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: practice-data resource: "https://idss-mesa.github.io/trainings/tutorials/practice-data/" title: "Practice data: five invented rain gauges" author: "team:idss-mesa" - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" --- # How to use the trace cards A trace card shows one short run of an AI agent, as text, and asks you to judge it. An agent in a MESA app answers a question by running things and reading what comes back[^docs-agents]. The record of those steps tells you far more than the final answer does. The cards let you practise reading such a record with no agent, no model, and no key. ## What is on a card | Part | What it holds | |---|---| | The question put to the agent | One sentence | | The run | Numbered lines: what the agent said it would do, what it ran, what came back, and its final answer | | Your task | Three questions, the same on every card | | Run the check | You run your own query on the practice data | | Answer | Folded away until you open it | Cards 1 to 7 are **constructed examples**: written by hand to show one thing clearly, and labelled so. No agent or model produced them. Card 9 is a **recorded run**: an agent in MESA JupyterLab produced it, and the card names the agent, the model and the date. The code on every card was run on the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/)[^practice-data], and the output shown is what it gives; a script compares them each time the site is built. ## How to work through one 1. Read the question, then the run, line by line. Do not skip to the answer the agent gave. 2. Answer the three questions for yourself, in writing: is the answer supported, where does it go wrong if it does, and what one query would settle it. 3. Run your query on the practice data. 4. Open the answer and compare. Some runs are sound. "Find the flaw" is not always the right answer, and saying that a sound run is sound, and why, is part of the skill. ## What to look for | Kind of failure | What it looks like in a run | |---|---| | A different question answered | The plan, or the query, asks for something other than what was asked | | A result misread | The call is right and what came back is right, but the agent says it means something it does not | | Stopped early | Every check made is correct, and one that matters was never made | Two more kinds are not in this practice set: a call that fails, after which the agent answers anyway; and a figure in the answer that no call returned. ## The cards - [Trace card 1: the wettest gauge in July](https://idss-mesa.github.io/trainings/trace-cards/card-1-wettest-gauge/) - [Trace card 2: G01's missing days](https://idss-mesa.github.io/trainings/trace-cards/card-2-missing-days/) - [Trace card 4: the wettest gauge, a second run](https://idss-mesa.github.io/trainings/trace-cards/card-4-wettest-gauge/) - [Trace card 5: the wettest gauge, a third run](https://idss-mesa.github.io/trainings/trace-cards/card-5-wettest-gauge/) - [Trace card 7: G03's July total](https://idss-mesa.github.io/trainings/trace-cards/card-7-g03-total/) - [Trace card 9: the wettest gauge, a recorded run](https://idss-mesa.github.io/trainings/trace-cards/card-9-wettest-gauge-recorded/) The numbers have gaps because cards 3, 6, and 8 are not published. ## Next - [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/) - [Keep a log of AI-assisted steps](https://idss-mesa.github.io/trainings/tutorials/keep-an-ai-log/) *This page was drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15. No person has yet checked it.* [^docs-agents]: https://idss-mesa.github.io/trainings/trace-cards/AI agents in the MESA apps, . [^practice-data]: https://idss-mesa.github.io/trainings/trace-cards/Practice data: five invented rain gauges, . ---8<--- https://idss-mesa.github.io/trainings/trace-cards/card-1-wettest-gauge/ --- type: Guide title: "Trace card 1: the wettest gauge in July" description: "A short constructed run of an AI agent answering \"Which gauge was wettest in July?\" on the practice data, for you to judge before you open the answer." tags: [trace-card, ai-agents, verification, practice-data] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: practice-data resource: "https://idss-mesa.github.io/trainings/tutorials/practice-data/" title: "Practice data: five invented rain gauges" author: "team:idss-mesa" - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" --- # Trace card 1: the wettest gauge in July !!! note "Constructed example" This run was written by hand, to practise on. No agent and no model produced it. The code in it was run on the practice data and gives the output shown. [How to use the trace cards](https://idss-mesa.github.io/trainings/trace-cards/how-to-use/) explains the format. **Card 1.** **Data:** `readings.csv` and `gauges.csv`, from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). **Time:** 5 to 8 minutes. ## The question put to the agent > Which gauge was wettest in July? ## The run Each numbered item is one line of the run: what the agent said, what it ran, or what it answered. 1. **The agent says:** "I will read both files, check which unit each gauge reports in, leave out anything repeated or flagged, and add up the rest for each gauge." 2. **The agent runs:** ```python import pandas as pd readings = pd.read_csv("readings.csv") gauges = pd.read_csv("gauges.csv") gauges[["gauge_id", "unit"]] ``` **It gets back:** ```text gauge_id unit 0 G01 mm 1 G02 cm 2 G03 mm 3 G04 mm 4 G05 mm ``` 3. **The agent says:** "G02 reports in centimetres. I will convert it to millimetres before I add anything up." 4. **The agent runs:** ```python clean = readings.drop_duplicates() clean = clean[clean["flag"] != "S"] (len(readings), len(clean)) ``` **It gets back:** ```text (152, 149) ``` 5. **The agent says:** "Three rows are left out: one exact repeat and two readings flagged `S`." 6. **The agent runs:** ```python clean = clean.merge(gauges[["gauge_id", "unit"]], on="gauge_id") clean["mm"] = clean["value"] * clean["unit"].map({"mm": 1, "cm": 10}) clean.groupby("gauge_id")["mm"].sum().round(1) ``` **It gets back:** ```text gauge_id G01 190.3 G02 218.3 G03 251.1 G04 198.8 G05 210.9 Name: mm, dtype: float64 ``` 7. **The agent answers:** "Observatory (G03) was the wettest gauge in July, with 251.1 mm. I converted G02 from centimetres to millimetres, and left out one repeated row and two readings the sensor flagged as suspect." ## Your task Decide before you open the answer. 1. Is the answer supported by the run? 2. If it is not, at which line does it go wrong? 3. What one query would confirm the answer or refute it? ## Run the check Run your query from question 3 on the practice data, in the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), and compare what you get with what the agent reported. ## Answer ??? success "Open the answer" **Verdict: supported.** Not every card hides a flaw. **Why.** Each thing the answer states came back from a call. The units are at line 2, the three rows left out are at line 4, and the totals are at line 6. The answer also says what was done to the data, so a reader can disagree with a choice. **A query that confirms it,** written another way, in SQL: ```python import duckdb duckdb.sql(""" SELECT r.gauge_id, round(sum(r.value * CASE g.unit WHEN 'cm' THEN 10 ELSE 1 END), 1) AS mm FROM (SELECT DISTINCT * FROM 'readings.csv') AS r JOIN 'gauges.csv' AS g ON r.gauge_id = g.gauge_id WHERE r.flag IS DISTINCT FROM 'S' GROUP BY r.gauge_id ORDER BY mm DESC """) ``` ```text ┌──────────┬────────┐ │ gauge_id │ mm │ │ varchar │ double │ ├──────────┼────────┤ │ G03 │ 251.1 │ │ G02 │ 218.3 │ │ G05 │ 210.9 │ │ G04 │ 198.8 │ │ G01 │ 190.3 │ └──────────┴────────┘ ``` **What the run did not look at.** Whether every gauge has a row for every day. G01 has none for 22 to 25 July. The largest reading at any other gauge on those days is: ```python float(readings[readings["date"].between("2026-07-22", "2026-07-25")]["value"].max()) ``` ```text 0.0 ``` Those days were dry everywhere, so the gap changes nothing here. A careful answer would still have said that it checked. ## Next - [Trace card 2: G01's missing days](https://idss-mesa.github.io/trainings/trace-cards/card-2-missing-days/) - The checks this run made, one at a time: [Bring two units onto one scale before comparing](https://idss-mesa.github.io/trainings/tutorials/convert-units-before-comparing/) and [Find and remove a repeated row](https://idss-mesa.github.io/trainings/tutorials/remove-a-repeated-row/). *Constructed example, drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15. The code was run that day outside MESA (pandas 3.1.1, DuckDB 2.0.0). No person has yet checked this card.* ---8<--- https://idss-mesa.github.io/trainings/trace-cards/card-2-missing-days/ --- type: Guide title: "Trace card 2: G01's missing days" description: "A short constructed run of an AI agent answering \"How many days is G01 missing in July?\" on the practice data, for you to judge before you open the answer." tags: [trace-card, ai-agents, verification, practice-data] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: practice-data resource: "https://idss-mesa.github.io/trainings/tutorials/practice-data/" title: "Practice data: five invented rain gauges" author: "team:idss-mesa" - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" --- # Trace card 2: G01's missing days !!! note "Constructed example" This run was written by hand, to practise on. No agent and no model produced it. The code in it was run on the practice data and gives the output shown. [How to use the trace cards](https://idss-mesa.github.io/trainings/trace-cards/how-to-use/) explains the format. **Card 2.** **Data:** `readings.csv`, from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). **Time:** 5 to 8 minutes. ## The question put to the agent > How many days is G01 missing in July? ## The run Each numbered item is one line of the run: what the agent said, what it ran, or what it answered. 1. **The agent says:** "I will count the days G01 has, and compare them with the calendar for July." 2. **The agent runs:** ```python import pandas as pd readings = pd.read_csv("readings.csv") g01 = readings[readings["gauge_id"] == "G01"] (len(g01), g01["date"].nunique(), g01["date"].min(), g01["date"].max()) ``` **It gets back:** ```text (27, 27, '2026-07-01', '2026-07-31') ``` 3. **The agent says:** "27 rows for 27 different days, so no day is repeated. The first and the last day of July are both there, so the gap is inside the month." 4. **The agent runs:** ```python july = pd.date_range("2026-07-01", "2026-07-31").strftime("%Y-%m-%d") sorted(set(july) - set(g01["date"])) ``` **It gets back:** ```text ['2026-07-22', '2026-07-23', '2026-07-24', '2026-07-25'] ``` 5. **The agent answers:** "G01 is missing four days in July 2026: the 22nd, 23rd, 24th, and 25th. It has 27 rows for 27 different days, so none of its days is repeated." ## Your task Decide before you open the answer. 1. Is the answer supported by the run? 2. If it is not, at which line does it go wrong? 3. What one query would confirm the answer or refute it? ## Run the check Run your query from question 3 on the practice data, in the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), and compare what you get with what the agent reported. ## Answer ??? success "Open the answer" **Verdict: supported.** Not every card hides a flaw. **Why.** The answer gives a count and the days, and both came back from line 4. Line 2 rules out the other way to get 27 rows from fewer days, a repeated day, before the agent relies on the count. **A query that confirms it,** from the other side: on those four days, which gauges do have a row? ```python readings[readings["date"].between("2026-07-22", "2026-07-25")].groupby("gauge_id").size() ``` ```text gauge_id G02 4 G03 4 G04 4 G05 4 dtype: int64 ``` Four gauges have all four days, and G01 is not in the list. ## Next - [Trace card 4: the wettest gauge, a second run](https://idss-mesa.github.io/trainings/trace-cards/card-4-wettest-gauge/) - The same check as a tutorial: [Count records per day to find incomplete days](https://idss-mesa.github.io/trainings/tutorials/count-records-per-day/). *Constructed example, drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15. The code was run that day outside MESA (pandas 3.1.1, DuckDB 2.0.0). No person has yet checked this card.* ---8<--- https://idss-mesa.github.io/trainings/trace-cards/card-4-wettest-gauge/ --- type: Guide title: "Trace card 4: the wettest gauge, a second run" description: "A short constructed run of an AI agent answering \"Which gauge was wettest in July?\" on the practice data, for you to judge before you open the answer." tags: [trace-card, ai-agents, verification, practice-data] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: practice-data resource: "https://idss-mesa.github.io/trainings/tutorials/practice-data/" title: "Practice data: five invented rain gauges" author: "team:idss-mesa" - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" --- # Trace card 4: the wettest gauge, a second run !!! note "Constructed example" This run was written by hand, to practise on. No agent and no model produced it. The code in it was run on the practice data and gives the output shown. [How to use the trace cards](https://idss-mesa.github.io/trainings/trace-cards/how-to-use/) explains the format. **Card 4.** **Data:** `readings.csv`, from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). **Time:** 5 to 8 minutes. ## The question put to the agent > Which gauge was wettest in July? ## The run Each numbered item is one line of the run: what the agent said, what it ran, or what it answered. 1. **The agent says:** "`readings.csv` has one row for each gauge and day, with the rainfall in `value`. I will add up `value` for each gauge." 2. **The agent runs:** ```python import pandas as pd readings = pd.read_csv("readings.csv") readings.head(3) ``` **It gets back:** ```text gauge_id date value flag 0 G01 2026-07-01 0.0 NaN 1 G01 2026-07-02 0.0 NaN 2 G01 2026-07-03 24.9 NaN ``` 3. **The agent runs:** ```python readings.groupby("gauge_id")["value"].sum() ``` **It gets back:** ```text gauge_id G01 190.30 G02 21.83 G03 273.60 G04 198.80 G05 390.90 Name: value, dtype: float64 ``` 4. **The agent answers:** "Quarry (G05) was the wettest gauge in July, with 390.9 mm. Orchard (G02) was much the driest, with 21.8 mm." ## Your task Decide before you open the answer. 1. Is the answer supported by the run? 2. If it is not, at which line does it go wrong? 3. What one query would confirm the answer or refute it? ## Run the check Run your query from question 3 on the practice data, in the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), and compare what you get with what the agent reported. ## Answer ??? success "Open the answer" **Verdict: not supported.** **Where it goes wrong: line 1.** The agent says what `value` holds without looking it up. It never opens `gauges.csv`, which records that G02 reports in centimetres, and it never looks at the `flag` column that line 2 shows. **Kind of failure: a result misread.** The sums at line 3 are correct arithmetic. Reading them as millimetres of trustworthy rain is the mistake. The clue is on the page: G02 at about a tenth of its neighbours. **A query that refutes it,** with the units made the same, the repeated row counted once, and the flagged readings left out: ```python import duckdb duckdb.sql(""" SELECT r.gauge_id, round(sum(r.value * CASE g.unit WHEN 'cm' THEN 10 ELSE 1 END), 1) AS mm FROM (SELECT DISTINCT * FROM 'readings.csv') AS r JOIN 'gauges.csv' AS g ON r.gauge_id = g.gauge_id WHERE r.flag IS DISTINCT FROM 'S' GROUP BY r.gauge_id ORDER BY mm DESC """) ``` ```text ┌──────────┬────────┐ │ gauge_id │ mm │ │ varchar │ double │ ├──────────┼────────┤ │ G03 │ 251.1 │ │ G02 │ 218.3 │ │ G05 │ 210.9 │ │ G04 │ 198.8 │ │ G01 │ 190.3 │ └──────────┴────────┘ ``` Observatory (G03) leads, with 251.1 mm. Of G05's 390.9, 180.0 is one reading flagged as suspect, and G02's true total is 218.3 mm, not 21.8. ## Next - [Trace card 5: the wettest gauge, a third run](https://idss-mesa.github.io/trainings/trace-cards/card-5-wettest-gauge/) - [Read the data dictionary before the data](https://idss-mesa.github.io/trainings/tutorials/read-the-data-dictionary/) *Constructed example, drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15. The code was run that day outside MESA (pandas 3.1.1, DuckDB 2.0.0). No person has yet checked this card.* ---8<--- https://idss-mesa.github.io/trainings/trace-cards/card-5-wettest-gauge/ --- type: Guide title: "Trace card 5: the wettest gauge, a third run" description: "A short constructed run of an AI agent answering \"Which gauge was wettest in July?\" on the practice data, for you to judge before you open the answer." tags: [trace-card, ai-agents, verification, practice-data] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: practice-data resource: "https://idss-mesa.github.io/trainings/tutorials/practice-data/" title: "Practice data: five invented rain gauges" author: "team:idss-mesa" - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" --- # Trace card 5: the wettest gauge, a third run !!! note "Constructed example" This run was written by hand, to practise on. No agent and no model produced it. The code in it was run on the practice data and gives the output shown. [How to use the trace cards](https://idss-mesa.github.io/trainings/trace-cards/how-to-use/) explains the format. **Card 5.** **Data:** `readings.csv`, from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). **Time:** 5 to 8 minutes. ## The question put to the agent > Which gauge was wettest in July? ## The run Each numbered item is one line of the run: what the agent said, what it ran, or what it answered. 1. **The agent says:** "To find the wettest gauge I will look for the largest reading." 2. **The agent runs:** ```python import pandas as pd readings = pd.read_csv("readings.csv") readings.loc[readings["value"].idxmax()] ``` **It gets back:** ```text gauge_id G05 date 2026-07-09 value 180.0 flag S Name: 129, dtype: object ``` 3. **The agent answers:** "Quarry (G05) was the wettest gauge in July. It recorded 180.0 mm on 9 July, far more than any other gauge on any day." ## Your task Decide before you open the answer. 1. Is the answer supported by the run? 2. If it is not, at which line does it go wrong? 3. What one query would confirm the answer or refute it? ## Run the check Run your query from question 3 on the practice data, in the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), and compare what you get with what the agent reported. ## Answer ??? success "Open the answer" **Verdict: not supported.** **Where it goes wrong: line 1.** The question is about a month. The plan looks for one reading. Everything after it is carried out correctly, on the wrong question. **Kind of failure: a different question answered.** The call at line 2 does what it was asked to do, and the figure in the answer is in the data. An answer can be retrieved, and exact, and still not be the answer to what was asked. **What else to notice.** Line 2 came back with `flag` set to `S`: the one reading the answer rests on is marked suspect, and the answer does not say so. **A query that refutes it,** by answering the question that was asked: ```python import duckdb duckdb.sql(""" SELECT r.gauge_id, round(sum(r.value * CASE g.unit WHEN 'cm' THEN 10 ELSE 1 END), 1) AS mm FROM (SELECT DISTINCT * FROM 'readings.csv') AS r JOIN 'gauges.csv' AS g ON r.gauge_id = g.gauge_id WHERE r.flag IS DISTINCT FROM 'S' GROUP BY r.gauge_id ORDER BY mm DESC """) ``` ```text ┌──────────┬────────┐ │ gauge_id │ mm │ │ varchar │ double │ ├──────────┼────────┤ │ G03 │ 251.1 │ │ G02 │ 218.3 │ │ G05 │ 210.9 │ │ G04 │ 198.8 │ │ G01 │ 190.3 │ └──────────┴────────┘ ``` Over the month, Observatory (G03) leads with 251.1 mm. ## Next - [Trace card 7: G03's July total](https://idss-mesa.github.io/trainings/trace-cards/card-7-g03-total/) - [Tally a quality flag before you trust a number](https://idss-mesa.github.io/trainings/tutorials/tally-a-quality-flag/) *Constructed example, drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15. The code was run that day outside MESA (pandas 3.1.1, DuckDB 2.0.0). No person has yet checked this card.* ---8<--- https://idss-mesa.github.io/trainings/trace-cards/card-7-g03-total/ --- type: Guide title: "Trace card 7: G03's July total" description: "A short constructed run of an AI agent answering \"What is G03's July total?\" on the practice data, for you to judge before you open the answer." tags: [trace-card, ai-agents, verification, practice-data] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: practice-data resource: "https://idss-mesa.github.io/trainings/tutorials/practice-data/" title: "Practice data: five invented rain gauges" author: "team:idss-mesa" - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" --- # Trace card 7: G03's July total !!! note "Constructed example" This run was written by hand, to practise on. No agent and no model produced it. The code in it was run on the practice data and gives the output shown. [How to use the trace cards](https://idss-mesa.github.io/trainings/trace-cards/how-to-use/) explains the format. **Card 7.** **Data:** `readings.csv` and `gauges.csv`, from the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). **Time:** 5 to 8 minutes. ## The question put to the agent > What is G03's July total? ## The run Each numbered item is one line of the run: what the agent said, what it ran, or what it answered. 1. **The agent says:** "I will check G03's unit and its flagged readings, then add up its values." 2. **The agent runs:** ```python import pandas as pd readings = pd.read_csv("readings.csv") gauges = pd.read_csv("gauges.csv") gauges[gauges["gauge_id"] == "G03"] ``` **It gets back:** ```text gauge_id name unit elevation_m 2 G03 Observatory mm 688 ``` 3. **The agent runs:** ```python g03 = readings[readings["gauge_id"] == "G03"] g03["flag"].value_counts(dropna=False) ``` **It gets back:** ```text flag NaN 31 S 1 Name: count, dtype: int64 ``` 4. **The agent runs:** ```python g03[g03["flag"] == "S"] ``` **It gets back:** ```text gauge_id date value flag 76 G03 2026-07-18 0.0 S ``` 5. **The agent says:** "The one flagged reading is 0.0, so the total is the same whether I keep it or not." 6. **The agent runs:** ```python float(g03["value"].sum().round(1)) ``` **It gets back:** ```text 273.6 ``` 7. **The agent answers:** "Observatory (G03) recorded 273.6 mm in July. It reports in millimetres, and its one flagged reading is 0.0, so it does not change the total." ## Your task Decide before you open the answer. 1. Is the answer supported by the run? 2. If it is not, at which line does it go wrong? 3. What one query would confirm the answer or refute it? ## Run the check Run your query from question 3 on the practice data, in the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), and compare what you get with what the agent reported. ## Answer ??? success "Open the answer" **Verdict: not supported.** **Where it goes wrong.** No line is wrong. Everything the agent checked, it checked correctly: the unit at line 2, the flag at lines 3 to 5. It stopped one check short and answered at line 7. The clue it passed over is at line 3: 31 rows and 1 row make 32, and July has 31 days. **Kind of failure: stopped early.** A run that makes two careful checks reads as thorough. Ask what it did not look at. **A query that refutes it:** count G03's rows and its different days. ```python (len(g03), g03["date"].nunique()) ``` ```text (32, 31) ``` One day is written twice. With the repeated row counted once: ```python float(g03.drop_duplicates()["value"].sum().round(1)) ``` ```text 251.1 ``` G03's July total is 251.1 mm, not 273.6. ## Next - [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/) - [Find and remove a repeated row](https://idss-mesa.github.io/trainings/tutorials/remove-a-repeated-row/) *Constructed example, drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15. The code was run that day outside MESA (pandas 3.1.1, DuckDB 2.0.0). No person has yet checked this card.* ---8<--- https://idss-mesa.github.io/trainings/trace-cards/card-9-wettest-gauge-recorded/ --- type: Guide title: "Trace card 9: the wettest gauge, a recorded run" description: "A real run of an AI agent in MESA JupyterLab answering \"Which gauge was wettest in July?\" on the practice data, for you to judge before you open the answer." tags: [trace-card, ai-agents, verification, practice-data] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-22T00:00:00Z" } stale_after: "2027-05-22T00:00:00Z" sources: - id: practice-data resource: "https://idss-mesa.github.io/trainings/tutorials/practice-data/" title: "Practice data: five invented rain gauges" author: "team:idss-mesa" - id: docs-agents resource: "https://idss-mesa.github.io/docs/apps/agents/" title: "AI agents in the MESA apps" author: "team:idss-mesa" --- # Trace card 9: the wettest gauge, a recorded run !!! note "Recorded run" An agent produced this run: OpenCode 1.19.4, agent `build`, model `js2/gpt-oss-120b` through AI Verde, in MESA JupyterLab on 2026-11-22. It was started with one command, `opencode run`, in a folder holding copies of the five practice files. The calls, the result at line 5 and the answer are as recorded. What the reads returned is shortened here, from the files themselves. [How to use the trace cards](https://idss-mesa.github.io/trainings/trace-cards/how-to-use/) explains the format. **Card 9.** **Data:** the five files of the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). **Time:** 5 to 8 minutes. ## The question put to the agent > Which gauge was wettest in July? ## The run Each numbered item is one line of the run. This agent did not say what it planned: the record holds only its calls and its answer. 1. **The agent calls** `filesystem_list_directory` on its folder. **It gets back** five files: `gauge_sites.csv`, `gauges.csv`, `observations.csv`, `readings.csv` and `readings_august.csv`. 2. **The agent calls** `read` on the first 20 lines of `observations.csv`. **It gets back** hourly rows, beginning: ```text gauge_id,timestamp_utc,measurement,value G03,2026-07-10T06:00:00Z,rain_mm,0.0 G03,2026-07-10T06:00:00Z,air_temp_c,13.8 ``` 3. **The agent calls** `grep` for `2026-07` in the CSV files. **It gets back** 100 matches. 4. **The agent calls** `read` on `readings.csv`. **It gets back** the file, beginning: ```text gauge_id,date,value,flag G01,2026-07-01,0.0, G01,2026-07-02,0.0, G01,2026-07-03,24.9, ``` 5. **The agent runs** a shell command: ```bash awk -F',' 'NR>1 {sum[$1]+=$3} END {for (g in sum) print g, sum[g]}' readings.csv ``` **It gets back:** ```text G03 273.6 G04 198.8 G01 190.3 G02 21.83 G05 390.9 ``` 6. **The agent calls** `read` on `gauges.csv`. **It gets back:** ```text gauge_id,name,unit,elevation_m G01,Boathouse,mm,512 G02,Orchard,cm,540 G03,Observatory,mm,688 G04,Depot,mm,521 G05,Quarry,mm,603 ``` 7. **The agent answers:** "The **Quarry** gauge (ID G05) recorded the highest total precipitation in July, with about **390.9 mm** of rain." ## Your task Decide before you open the answer. 1. Is the answer supported by the run? 2. If it is not, at which line does it go wrong? 3. What one query would confirm the answer or refute it? ## Run the check Run your query from question 3 on the practice data, in the notebook from [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), and compare what you get with what the agent reported. ## Answer ??? success "Open the answer" **Verdict: not supported.** **Where it goes wrong: between lines 5 and 7.** Line 5 adds up `value` for every row. The header at line 4 shows a `flag` column, and the sum never looks at it. Line 6 shows that G02 reports in centimetres, and the answer takes only a name from that result. **Kind of failure: a result misread.** The arithmetic at line 5 is right. You can reproduce it: ```python import pandas as pd readings = pd.read_csv("readings.csv") readings.groupby("gauge_id")["value"].sum() ``` ```text gauge_id G01 190.30 G02 21.83 G03 273.60 G04 198.80 G05 390.90 Name: value, dtype: float64 ``` Reading 390.9 as millimetres of trustworthy rain is the mistake. Unlike the run on [card 4](https://idss-mesa.github.io/trainings/trace-cards/card-4-wettest-gauge/), this agent did open the file that holds the unit. It opened it after it had its number. **A query that refutes it,** with the units made the same, the repeated row counted once, and the flagged readings left out: ```python import duckdb duckdb.sql(""" SELECT r.gauge_id, round(sum(r.value * CASE g.unit WHEN 'cm' THEN 10 ELSE 1 END), 1) AS mm FROM (SELECT DISTINCT * FROM 'readings.csv') AS r JOIN 'gauges.csv' AS g ON r.gauge_id = g.gauge_id WHERE r.flag IS DISTINCT FROM 'S' GROUP BY r.gauge_id ORDER BY mm DESC """) ``` ```text ┌──────────┬────────┐ │ gauge_id │ mm │ │ varchar │ double │ ├──────────┼────────┤ │ G03 │ 251.1 │ │ G02 │ 218.3 │ │ G05 │ 210.9 │ │ G04 │ 198.8 │ │ G01 │ 190.3 │ └──────────┴────────┘ ``` Observatory (G03) leads, with 251.1 mm. Of G05's 390.9, 180.0 is one reading flagged as suspect. **One run is not a rate.** The same question, put again that day, was answered the same way by a different route. Your own agent may answer differently. ## Next - [Read back what an agent ran](https://idss-mesa.github.io/trainings/tutorials/read-what-an-agent-ran/): how a record like this one is taken from OpenCode. - [Check an AI-suggested result against the data](https://idss-mesa.github.io/trainings/tutorials/check-a-suggested-result/) *Recorded run, written up with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-22. An AI assistant started the run on a test account after a person entered the model key. The code in the answer was run that day outside MESA (pandas 3.1.1, DuckDB 2.0.0). No person has yet checked this card.* ---8<--- https://idss-mesa.github.io/trainings/bring-your-own-data/ --- type: Reference title: "Bring your own data to MESA" description: "What data you can bring into MESA to work on, what to leave out, how to get it into your Data Store, how to check it arrived, and what to do if it is not ready." tags: [data, data-store, privacy, readme] status: draft generated: { by: "claude-code/mythos-5.2", at: "2026-11-15T00:00:00Z" } stale_after: "2027-05-15T00:00:00Z" sources: - id: docs-data resource: "https://idss-mesa.github.io/docs/portal/data/" title: "Managing data in the MESA Portal" author: "team:idss-mesa" - id: docs-jupyterlab resource: "https://idss-mesa.github.io/docs/apps/jupyterlab/" title: "MESA JupyterLab" author: "team:idss-mesa" - id: usage resource: "https://idss-mesa.github.io/trainings/tutorials/check-your-usage/" title: "Check your CPU hours and storage" author: "team:idss-mesa" --- # Bring your own data to MESA !!! warning "Draft: not yet tried with real datasets" This page was written from the MESA documentation and the tutorials on this site. Nobody has yet used it to bring a dataset of their own into MESA. [Tell us what you find](https://github.com/idss-mesa/trainings/issues). The tutorials on this site use a small practice dataset. You can follow the same steps on data of your own. This page says what to bring, what to leave out, and how to tell that your data is ready to work on. ## What you can bring - **Tables as CSV or Parquet files.** These are the two formats the tutorials read, and MESA JupyterLab includes DuckDB for querying both[^docs-jupyterlab]. The apps also hold Python, R, and Julia with their usual data libraries, so other formats may open, but this site has not tried them. - **Less than your storage allowance, with room to spare.** Your plan sets how much your Data Store holds and how many CPU hours you may use. [Check your CPU hours and storage](https://idss-mesa.github.io/trainings/tutorials/check-your-usage/) shows where to read both[^usage]. On a new Basic plan they read 5 GB and 200 hours on 2026-11-13; yours may differ. - **A part before the whole.** If the dataset is large, bring one file, or one month, first. A sample that opens in a few seconds is enough to learn on. ## What not to bring Leave a dataset out if the answer to any of these is yes, or if you are not sure: 1. Does it describe people: names, contact details, health, or anything that could identify a person? 2. Did it come under an agreement or a license that forbids copying it to a shared platform? 3. Does any file hold a password, a token, or a key? 4. Does it give the exact place of something that could be harmed if the place were known, such as a protected species or a site that a community keeps private? 5. Is it someone else's, and have they not agreed to your using it here? A folder in your Data Store is marked **Private** until you share it. Even so, you may work beside other people or show your screen, and an AI agent you start in an app acts with your access. ## Getting it into your Data Store - From your computer: [Upload a file from your computer to your Data Store](https://idss-mesa.github.io/trainings/tutorials/upload-a-file/). Reference: [Managing data, "Upload, create, move, and delete"](https://idss-mesa.github.io/docs/portal/data/#upload-create-move-and-delete)[^docs-data]. - From the web: [Download a file from the web into your Data Store with MESA Cloud Shell](https://idss-mesa.github.io/trainings/tutorials/cloud-shell-download/). Put it in a folder of its own. [Make a folder in your Data Store](https://idss-mesa.github.io/trainings/tutorials/make-a-folder/) shows how. ## Check it arrived 1. Open it: [Load a file from your Data Store into a notebook](https://idss-mesa.github.io/trainings/tutorials/load-a-file/), with your file's name in place of the practice file's. 2. Count its rows and compare with the number you expect from the source. 3. Look at each column you will use: [Check a column's range and missing values](https://idss-mesa.github.io/trainings/tutorials/check-range-and-missing/). If the row count is right and the columns hold what you expect, the data is ready. ## Describe it - [Write a README for a data folder](https://idss-mesa.github.io/trainings/tutorials/write-a-readme/), and [say where the data came from](https://idss-mesa.github.io/trainings/tutorials/say-where-data-came-from/). - [Add metadata to a file or folder](https://idss-mesa.github.io/trainings/tutorials/add-metadata/), so that the same facts can be searched. ## If your data are not ready Use the [practice data](https://idss-mesa.github.io/trainings/tutorials/practice-data/). Every tutorial here runs on it, and what you learn carries over to your own data unchanged. Nothing is lost by starting there and coming back to your own files later. *This page was drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) on 2026-11-15 from the MESA documentation. No person has yet checked it.* [^docs-data]: https://idss-mesa.github.io/trainings/Managing data in the MESA Portal, . [^docs-jupyterlab]: https://idss-mesa.github.io/trainings/MESA JupyterLab, . [^usage]: https://idss-mesa.github.io/trainings/Check your CPU hours and storage, . ---8<--- https://idss-mesa.github.io/trainings/about/license/ --- type: Reference title: "License" description: "The licenses of MESA Trainings: CC BY 4.0 for the training content and BSD 3-Clause for code, with the attribution line to use." tags: [about, license, cc-by, bsd-3-clause] status: draft generated: { by: "claude-code/2.1.224", at: "2026-11-11T00:00:00Z" } sources: - id: cc-by resource: "https://creativecommons.org/licenses/by/4.0/" title: "Creative Commons Attribution 4.0 International" author: "team:creative-commons" - id: repo resource: "https://github.com/idss-mesa/trainings" title: "idss-mesa/trainings repository (LICENSE and LICENSE-CODE)" author: "team:idss-mesa" --- # License MESA Trainings has two licenses, one for the teaching material and one for code. | What | License | Full text | |---|---|---| | Training content: the tutorials, the other pages of this site, and their images | [Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/)[^cc-by] | [`LICENSE`](https://github.com/idss-mesa/trainings/blob/main/LICENSE) | | Code: the scripts that build the site, and code samples in the tutorials | BSD 3-Clause, as in the other MESA repositories | [`LICENSE-CODE`](https://github.com/idss-mesa/trainings/blob/main/LICENSE-CODE) | Copyright © 2026 The Regents of the University of New Mexico[^repo]. ## Reusing a tutorial You may copy, share, and adapt the training content for any purpose, as long as you give credit, link to the license, and say whether you changed anything. An attribution line such as this is enough: ```text "" by the MESA project (https://idss-mesa.github.io/trainings/), licensed CC BY 4.0. ``` ## Material from elsewhere Screenshots of the MESA Portal are shown from the [MESA documentation](https://idss-mesa.github.io/docs/) and belong to that project. A tutorial that uses a dataset carries that dataset's own attribution line. ## Acknowledgment MESA is supported by the U.S. National Science Foundation under [Award #2632685](https://www.nsf.gov/awardsearch/show-award/?AWD_ID=2632685) (Integrated Data Systems & Services). Any opinions, findings, and conclusions are those of the authors and do not necessarily reflect the views of the NSF. [^cc-by]: https://idss-mesa.github.io/trainings/about/Creative Commons Attribution 4.0 International, . [^repo]: https://idss-mesa.github.io/trainings/about/idss-mesa/trainings repository, . ---8<--- https://idss-mesa.github.io/trainings/about/ai-disclosure/ --- type: Reference title: "How AI was used to make this site" description: "Which parts of MESA Trainings were drafted with an AI assistant, what a person has and has not checked, and how to tell for any single page." tags: [about, ai-disclosure, provenance] status: draft generated: { by: "claude/mythos-5.2", at: "2026-11-14T00:00:00Z" } sources: - id: repo resource: "https://github.com/idss-mesa/trainings" title: "idss-mesa/trainings repository (front matter, AGENTS.md, and docs/log.md)" author: "team:idss-mesa" - id: template resource: "https://idss-mesa.github.io/trainings/template/" title: "Tutorial template" author: "team:idss-mesa" --- # How AI was used to make this site Every page on this site was drafted with an AI assistant, working under the direction of the MESA training team[^repo]. This page says what that covers, what it does not tell you, and how to check any page for yourself. ## What was drafted with AI | Part of the site | How AI was used | |---|---| | Tutorials | The text, steps, and code were drafted by an AI coding assistant from the MESA documentation | | Printed results in tutorials | Real output from running the code. Scripts compare them again each time the site is built | | Learning pathways and self-checks | Drafted with AI assistance | | Practice data | Synthetic files made by a script with a fixed seed. The page describing them was drafted with AI assistance | | Other pages, including this one | Drafted with AI assistance | ## What a person has checked Being drafted with AI says nothing about whether a page is right. Two other signals do. - **The draft notice.** A tutorial marked *Draft: not yet validated* has not been followed from start to finish by a person. Today that is every tutorial. - **The last line.** Each tutorial ends by saying what was run or followed, where, and when. If that line does not name a person, read it as "not yet checked by one". When a person validates a tutorial, the notice comes off and the last line names them. The statement that AI helped draft it stays[^template]. ## How to tell for one page 1. Read the tutorial's last line. 2. For the exact tool, open the page's Markdown twin (the page address plus `index.md`) and read `generated.by` at the top. A tool name and version means an AI assistant or other tool wrote that version of the page. `human:` followed by a name means a person did. 3. The [changelog](https://idss-mesa.github.io/trainings/log/) records what was checked on the live portal, by date. ## What this means for you - Follow a draft with care. Screen names and steps come from documentation and may differ from what you see. - If a step is wrong, [open an issue](https://github.com/idss-mesa/trainings/issues). A correction from someone who has just followed the steps is the most useful contribution this site can get. - If you reuse a tutorial under its [license](https://idss-mesa.github.io/trainings/about/license/), keep the statement that it was drafted with AI assistance. ## If you contribute Say when you used AI, in the page's last line and in `generated.by`. See [Contribute a tutorial](https://idss-mesa.github.io/trainings/contributing/). [^repo]: https://idss-mesa.github.io/trainings/about/idss-mesa/trainings repository, . [^template]: https://idss-mesa.github.io/trainings/about/Tutorial template, . ---8<--- https://idss-mesa.github.io/trainings/about/ai-agents/ --- type: Reference title: "For AI agents" description: "How agents should read MESA Trainings: llms.txt, per-page Markdown with OKF frontmatter, and the draft and trust signals on every tutorial." tags: [about, ai-agents, OKF, llms.txt] status: draft generated: { by: "claude-code/2.1.224", at: "2026-11-11T00:00:00Z" } sources: - id: okf-spec resource: "https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md" title: "Open Knowledge Format (OKF) v0.2 specification" author: "team:google-cloud" - id: docs-agents resource: "https://idss-mesa.github.io/docs/about/ai-agents/" title: "For AI agents (MESA documentation)" author: "team:idss-mesa" --- # For AI agents This site is published for people and for AI agents. Its source is an [Open Knowledge Format (OKF) v0.2](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md) knowledge bundle[^okf-spec] that follows the same conventions as the MESA documentation[^docs-agents]. ## Entry points | What | Address | |---|---| | Outline of every page | [`https://idss-mesa.github.io/trainings/llms.txt`](https://idss-mesa.github.io/trainings/llms.txt) | | Whole site in one file | [`https://idss-mesa.github.io/trainings/llms-full.txt`](https://idss-mesa.github.io/trainings/llms-full.txt) | | Markdown twin of a page | The page address plus `index.md`, for example [`https://idss-mesa.github.io/trainings/tutorials/sign-in/index.md`](https://idss-mesa.github.io/trainings/tutorials/sign-in/index.md) | | Raw source on GitHub | [`https://raw.githubusercontent.com/idss-mesa/trainings/main/docs/tutorials/sign-in.md`](https://raw.githubusercontent.com/idss-mesa/trainings/main/docs/tutorials/sign-in.md) | Crawlers honour only the origin's [`https://idss-mesa.github.io/robots.txt`](https://idss-mesa.github.io/robots.txt), which is fully permissive. ## Trust signals - **`status: draft`** means the tutorial was written from documentation and has not been followed on the live portal. Treat its screen names and steps as likely, not confirmed, and say so when you relay them. - **No `verified:` key** means unverified (OKF §5.3). Only a human maintainer adds it. - **`stale_after`** is the review date. After it, check the tutorial against the [MESA documentation](https://idss-mesa.github.io/docs/) before relying on it. - Tutorials tagged `byte` are single-task pages; the `p1` to `p5` tag groups them by stage, from first sign-in to sharing results. ## When to read something else These pages teach people to use the portal by hand. For how a feature works, read the [MESA documentation](https://idss-mesa.github.io/docs/llms.txt). For CyVerse data itself, connect to the MESA MCP servers and call their tools, as the [documentation's agent guide](https://idss-mesa.github.io/docs/about/ai-agents/) explains. [^okf-spec]: https://idss-mesa.github.io/trainings/about/Open Knowledge Format v0.2 specification, . [^docs-agents]: https://idss-mesa.github.io/trainings/about/For AI agents, MESA documentation, . ---8<--- https://idss-mesa.github.io/trainings/log/ # Directory Update Log ## 2026-11-24 * **Creation**: Four draft tutorials for the other tabs of the portal's full metadata page: [Add Dublin Core fields to a folder](tutorials/describe-with-dublin-core-fields.md), [Record where and when data was collected, with EML fields](tutorials/describe-with-eml-fields.md), [Make a folder's metadata valid Croissant](tutorials/make-metadata-valid-croissant.md), and [Tag a folder with an ontology term](tutorials/tag-with-an-ontology-term.md). The AI assistant that drafted them followed each once on the live portal that day; no person has. The Local Contexts tab was not tried and has no tutorial. * **Creation**: A draft tutorial, [Describe a folder with DataCite fields](tutorials/describe-with-datacite-fields.md): fill in title, publisher, year, type, and creator on the portal's full metadata page. The AI assistant that drafted it followed the steps once on the live portal that day; no person has. [Add metadata to a file or folder](tutorials/add-metadata.md) links to it. ## 2026-11-23 * **Update**: The pathway [Use an AI agent and check what it says](pathways/use-an-ai-agent.md) now lists the five explainers and the trace cards under a new heading, Ideas and practice. They are not counted in the essentials or in a reader's progress. The pathway also lists [Check what an agent may change before you let it](tutorials/check-what-an-agent-may-change.md) among the tutorials for when you have more time; it had been left out. The page on how to use the trace cards now lists card 9. ## 2026-11-22 * **Creation**: [Trace card 9](trace-cards/card-9-wettest-gauge-recorded.md), the first card that is a recorded run and not a constructed one: OpenCode in MESA JupyterLab, asked which gauge was wettest in July. Its calls and its answer are as recorded; what its reads returned is shortened from the files. The page on how to use the cards now says which cards are constructed and which is recorded. * **Creation**: An explainer, [When to stop and ask](explainers/when-to-stop-and-ask.md): the steps that should wait for a person before an AI agent takes them. What it says about MESA comes from the agents page of the documentation. A draft; nobody has reviewed it. The tutorial on what an agent may change links to it. ## 2026-11-20 * **Update**: The [Explainers](explainers/index.md), [Trace cards](trace-cards/index.md) and [About](about/index.md) section pages open with a sentence saying what the section holds and show their pages as cards. On Trace cards, the page on how to use them comes first, across the full width. Without scripts each is still the plain list. * **Update**: On the pathway pages the dashed line now continues beside the last point's tutorials. It used to stop at the number 5. * **Update**: The Tutorials menu is grouped. The 87 tutorials sit under the five pathway points, and within a point under the same headings as [Every tutorial, by point](pathway.md), in place of one list in the order the pages were written. No page moved and no address changed. * **Creation**: A tutorial at point 4, Analyze with AI: [Check what an agent may change before you let it](tutorials/check-what-an-agent-may-change.md), which reads OpenCode's permission rules and tests them in a scratch folder. Every command was run in MESA JupyterLab. A draft. ## 2026-11-19 * **Update**: The pathway [Use an AI agent and check what it says](pathways/use-an-ai-agent.md) gains a third optional page at point 4, [Ask an agent for a query, then run it yourself](tutorials/ask-for-a-query-then-run-it.md). It comes last among the optional pages, so routes with a time limit do not change. * **Creation**: A tutorial at point 4, Analyze with AI: [Ask an agent for a query, then run it yourself](tutorials/ask-for-a-query-then-run-it.md), in which the agent drafts a DuckDB query and the reader reads it, saves it and runs it. The request was sent twice in MESA JupyterLab and the code was run there. A draft. * **Update**: The pathway [Use an AI agent and check what it says](pathways/use-an-ai-agent.md) gains a second optional page at point 4, [Read back what an agent ran](tutorials/read-what-an-agent-ran.md). It comes last among the optional pages, so a route with a time limit keeps the AI log ahead of it. * **Creation**: A tutorial at point 4, Analyze with AI: [Read back what an agent ran](tutorials/read-what-an-agent-ran.md), which exports an OpenCode session and prints each tool call. Steps 1 to 3 were run in MESA JupyterLab. A draft. * **Update**: [See which tool servers your agent can use](tutorials/see-an-agents-tools.md): the list was read again after `cyverse-login` and is the same as before it. * **Update**: The pathway [Use an AI agent and check what it says](pathways/use-an-ai-agent.md) gains an optional page at point 4, [See which tool servers your agent can use](tutorials/see-an-agents-tools.md). A reader with 30 minutes or more is now offered it. * **Creation**: A tutorial at point 4, Analyze with AI: [See which tool servers your agent can use](tutorials/see-an-agents-tools.md), which lists an agent's tool servers with `opencode mcp list` and reads which are connected. The command was run in MESA JupyterLab without a sign-in. A draft. ## 2026-11-18 * **Creation**: A tutorial at point 5, Preserve and share: [State what AI did in your analysis](tutorials/state-what-ai-did.md), which adds an "AI assistance" section to a folder's README. A draft; not yet followed in MESA JupyterLab. * **Update**: [Sign in and start an AI agent in a MESA app](tutorials/start-an-ai-agent.md) was run through all six steps in MESA JupyterLab. Step 3 gains a line that loads the saved key, without which the agent fails with "No api key passed in", and that failure has its own entry under "If it didn't". Steps 3 to 5 now say what was seen. Still a draft. * **Creation**: A fourth explainer, [How an agent reaches data: tools and MCP](explainers/tools-and-mcp.md): what a server, a tool and a call are, and the four tool servers in the MESA apps. A draft. * **Update**: [Sign in and start an AI agent in a MESA app](tutorials/start-an-ai-agent.md): a later sign-in in the same app finished, so the `Authenticated as` line in step 2 has now been seen. Still a draft; steps 3 to 6 have not been run. * **Update**: [Sign in and start an AI agent in a MESA app](tutorials/start-an-ai-agent.md) now says what `cyverse-login` asks for and prints, from a run of steps 1 and 2 in MESA JupyterLab, and has two new entries under "If it didn't": the sign-in test failing because the Data Store does not answer, and a command stopping at `iRODS Password:`. The sign-in did not finish in that run. Still a draft. ## 2026-11-17 * **Creation**: A second tutorial for each of the other MESA apps: [Keep a command running in MESA Cloud Shell after you close the tab](tutorials/cloud-shell-keep-running.md), [Find a value in every file of a folder with MESA VS Code](tutorials/vscode-find-in-folder.md) and [Open a terminal in a Data Store folder on the MESA desktop](tutorials/desktop-open-a-terminal.md). All are drafts. * **Creation**: Three tutorials at point 5, Preserve and share, for MESA RStudio Geospatial: [Record the R and package versions a result depends on](tutorials/r-record-software-versions.md), [Write a README for a data folder, from RStudio](tutorials/r-write-a-readme.md) and [Hand your folder to a colleague and have them rerun it, in R](tutorials/r-hand-over-and-rerun.md). All are drafts. The hand-over needs two accounts; only its rerun step was run. * **Creation**: R versions of the four point 4 checks, for MESA RStudio Geospatial: [Plot a column to spot odd values in R](tutorials/r-plot-to-spot-odd-values.md), [Check a result a second way in R](tutorials/r-check-a-result-two-ways.md), [Check that the parts add up to the whole in R](tutorials/r-check-parts-add-up.md) and [Compare two files that should look alike in R](tutorials/r-compare-two-files.md). All are drafts. The second-way check uses base R, not DuckDB: `subset()` and square brackets treat a missing flag differently, and neither keeps the unflagged rows. * **Creation**: Four tutorials at point 4, Explore and verify, that need no AI assistant and no key: [Plot a column to spot odd values](tutorials/plot-to-spot-odd-values.md), [Check a result a second way](tutorials/check-a-result-two-ways.md), [Check that the parts add up to the whole](tutorials/check-parts-add-up.md) and [Compare two files that should look alike](tutorials/compare-two-files.md). All are drafts. The output check now skips a block that draws a chart. * **Update**: Corrected the draft notice on 33 older tutorials. Seven said their steps were followed "by the person who wrote them", and all 33 ended "Not yet validated by a second person". The AI assistant that drafted them followed them; no person has. The notices and last lines now say so, as the newer tutorials already did. [How AI was used](about/ai-disclosure.md) is corrected the same way. ## 2026-11-16 * **Update**: The remaining notebook steps of the Python tutorials were followed in MESA JupyterLab by the AI assistant that drafted them: making and renaming a notebook, the **Select Kernel** box, the practice-data download cell, a Markdown cell, and **File → Save Notebook** from the menu. Two corrections: [Load a file from your Data Store into a notebook](tutorials/load-a-file.md) and [Save your work where it survives the session](tutorials/save-your-work.md) now say to type the name without `.ipynb` when renaming, because the box keeps the ending and typing it again gives `.ipynb.ipynb`; and step 2 of [Query a Parquet file with DuckDB from a notebook](tutorials/query-parquet-with-duckdb.md) shows a small **Count** table, where the page said there was no output. All remain drafts. * **Update**: The site's output check was run inside MESA JupyterLab (Python 3.13.18, pandas 3.1.1, DuckDB 2.0.0): all 58 Python outputs on the tutorials and trace cards matched. Four tutorials that said their code was run outside MESA now say it was run there. [Leave a notebook someone else can rerun](tutorials/leave-a-rerunnable-notebook.md), [Keep tokens and passwords out of saved files](tutorials/keep-secrets-out-of-files.md), and [Save a query so someone else can run it](tutorials/save-a-query.md) were followed in a notebook there by the AI assistant that drafted them. Three corrections came of it: the search box shows `-/-` when nothing matches; the token box shows a dot for each character as you type; and in a notebook DuckDB draws a result as a table, not as the boxed text on the pages. That last was seen in one tutorial, and the note was added to the other two that show DuckDB results the same way. All remain drafts. * **Creation**: Added the last three R versions of the data tutorials at point 2: [Read the data dictionary before the data, in R](tutorials/r-read-the-data-dictionary.md), [Turn UTC timestamps into local days in R](tutorials/r-local-days-from-utc.md), and [Work with a long table in R](tutorials/r-work-with-a-long-table.md). The code was run in MESA RStudio Geospatial (R 4.6.2) by the AI assistant that drafted it; no person has yet followed the steps. Every Python data tutorial at points 2 and 3 now has an R version. * **Creation**: Added two portal tutorials: [Share an analysis with a collaborator](tutorials/share-an-analysis.md) and [Find a MESA working group and how to join it](tutorials/find-a-working-group.md). Each was followed once on the live portal by the AI assistant that drafted it. The collaborator's side of the share was not checked, and no request to join a group was sent. No person has yet followed them. * **Creation**: Added R versions of the four "Combine and clean" tutorials: [Join two tables in R and keep the unmatched rows visible](tutorials/r-join-and-keep-unmatched.md), [Bring two units onto one scale in R](tutorials/r-convert-units-before-comparing.md), [Find and remove a repeated row in R](tutorials/r-remove-a-repeated-row.md), and [Save a query from R so someone else can run it](tutorials/r-save-a-query.md). The code was run in MESA RStudio Geospatial (R 4.6.2) by the AI assistant that drafted it; no person has yet followed the steps. A reader who answers "R" on the pathways page is given these in place of the Python versions. * **Creation**: Added three tutorials for buttons the portal has now had repaired: [Upload a file from your computer to your Data Store](tutorials/upload-a-file.md), [Download a file from your Data Store to your computer](tutorials/download-a-file.md), and [Start a new file in the Data Browser](tutorials/make-a-new-file.md). Each was followed once on the live portal by the AI assistant that drafted it; in the upload tutorial the file was supplied by a script, because the test browser cannot open a file chooser. No person has yet followed them. * **Update**: The four R tutorials added today were followed in MESA RStudio Geospatial (R 4.6.2), and every output matched. Three details changed in [Leave an R script someone else can rerun](tutorials/r-leave-a-rerunnable-script.md): the **Save File** window opens on R's working folder; `source()` shortens the start of the script to `[TRUNCATED]`; and the folder is listed with `list.files()`, because the **Files** tab does not follow R's working folder. All remain drafts. * **Creation**: Added four tutorials for readers who work in R, each the R version of a Python one: [Check a column's range and missing values in R](tutorials/r-check-range-and-missing.md), [Count records per day in R](tutorials/r-count-records-per-day.md), [Reconcile row counts before and after a join in R](tutorials/r-reconcile-a-join.md), and [Leave an R script someone else can rerun](tutorials/r-leave-a-rerunnable-script.md). The code was run with R 4.6.0 on a laptop, and the site build runs it in the MESA RStudio Geospatial image; nobody has yet followed the steps in the app. A reader who answers "R" on the pathways page is now given these in place of the Python versions, and [Work in R](pathways/work-in-r.md) lists them under "If you have more time". * **Creation**: Added [Ask CyVerse for access to interactive apps](tutorials/request-app-access.md): the one-time request a new CyVerse account must send before it can start an app. The failed launch was seen on the live portal; the form itself was written from the Discovery Environment's public source code and has not been sent by the writer. It is listed under "If you have more time" in [New to MESA](pathways/new-to-mesa.md) and [Get ready for a hands-on session](pathways/get-ready-for-a-session.md), and the [launch tutorial](tutorials/launch-jupyterlab.md) now points to it. * **Update**: Four fixes to bringing back a saved copy on [Your progress](progress.md). Merging no longer drops a note: when the browser and the file both hold a note on the same point, the file's note is added below yours, and the message says so. If the two together are too long to keep, yours stays and the message says the file's was left out. When the stored record was made by a newer version of the site, "Save a copy to a file" now saves that record as it is stored, not an empty one. The message counts tutorials correctly ("1 finished tutorial") and counts only tutorials the site still has. The "Replace or merge?" and "Clear everything?" questions now take focus themselves, so pressing Enter straight away changes nothing. A file with a date that is not a real day, such as 2026-13-45, is refused. * **Update**: "Clear everything" on [Your progress](progress.md) now also clears what another open tab is showing. An answer given to a self-check on that visit used to stay on screen in the other tab until it was reloaded, although nothing was stored. * **Update**: Two fixes to the files saved from [Your progress](progress.md). A note typed just before pressing "Save my notes as Markdown" or "Save a copy to a file" was stored but left out of the file; both files now hold it. In the Markdown file each note is now a block quote with its line breaks kept, so a line of a note that starts with "#" can no longer become a heading of the file, and a tag in a note stays as text. * **Update**: Two fixes to the note boxes at the end of each point. A note is now stored a moment after you stop typing and when the page is hidden, closed or left, as well as when you leave the box; reloading with the cursor still in the box used to lose what had been typed. After "Clear everything" the line under an empty box no longer says "Saved in this browser." * **Update**: Two fixes to the self-checks. An answer typed with a decimal comma, such as 29,2 for 29.2, is now read as that number and no longer marked wrong; so is one that starts with its decimal point. A tutorial that was undone and marked done again is checked again when its self-check is already answered correctly; it used to be left as done only, with no way to answer the question a second time. * **Update**: Two fixes to marking a tutorial done. The done tick no longer appears on the links to a tutorial's own sections under "On this page"; it stays on the link to the tutorial. An extra tutorial opened after its pathway is finished no longer says it is "the last one"; it says the pathway is finished and that this one is extra. * **Update**: On [Learning pathways](pathways/index.md), answering one of the starting questions before choosing what brings you here now says "Your answers are kept" and announces it. It used to change the list of pathways below without saying anything. ## 2026-11-15 * **Creation**: Added a second kind of page, the explainer, which explains one idea and gives no steps, with three to begin: [What an agent is, and is not](explainers/what-an-agent-is.md), [Recalled or retrieved](explainers/recalled-or-retrieved.md), and [Reading what an agent did](explainers/reading-what-an-agent-did.md). The [tutorial template](template.md) says how one is written. * **Creation**: Added [Bring your own data to MESA](bring-your-own-data.md): what you can bring, what to leave out, how to get it into your Data Store, how to check it arrived, and what to do if it is not ready. A draft: nobody has yet used it with a dataset of their own. * **Creation**: Added five [trace cards](trace-cards/index.md): short runs of an AI agent on the practice data, written as text, for practising how to read what an agent did. Each asks whether the answer is supported, with the answer folded away. All five are constructed examples, written by hand and labelled so; some of the runs are sound. [How to use the trace cards](trace-cards/how-to-use.md) explains them. The output check now covers the cards, so every figure on one is recomputed when the site is built. * **Creation**: Added seven tutorials for the thinner pathway points. Under point 3: [Join two tables and keep the unmatched rows visible](tutorials/join-and-keep-unmatched.md), [Bring two units onto one scale before comparing](tutorials/convert-units-before-comparing.md), [Find and remove a repeated row](tutorials/remove-a-repeated-row.md), and [Save a query so someone else can run it](tutorials/save-a-query.md). Under point 4: [Keep a log of AI-assisted steps](tutorials/keep-an-ai-log.md). Under point 5: [Say where your input data came from](tutorials/say-where-data-came-from.md) and [Hand your folder to a colleague and have them rerun it](tutorials/hand-over-and-rerun.md). All are drafts. The code in the four data tutorials was run outside MESA with the versions MESA JupyterLab has; none has been followed in MESA. Each is in a [learning pathway](pathways/index.md) under "If you have more time". * **Creation**: Added a fifth practice file, [`readings_august.csv`](assets/practice/readings_august.csv): the same five gauges' daily readings for August 2026, described on the [practice data](tutorials/practice-data.md) page. The four files published earlier are unchanged, byte for byte, and a test now holds their checksums. * **Update**: A pathway point whose tutorials are all done no longer offers "Skip the rest of this point": there was nothing left to skip. It says the skip-check questions were answered. * **Update**: Answering a self-check on its tutorial no longer shortens your route. On Use an AI agent with an hour, a right answer on "Check an AI-suggested result" also counted as passing that point's skip-check, so two tutorials dropped off and the pathway read as finished early. Now only the "Check first" questions on a pathway page skip a point. If you got them all right on the tutorials, the pathway page says so and offers "Skip the rest of this point"; nothing is left out until you choose it. * **Update**: The answer boxes on the self-checks and the notes box under each point now use text of at least 16 pixels. They were at 15 on a phone, and below 16 Safari on an iPhone zooms the page in when a box is tapped and leaves it zoomed. * **Update**: In the six self-checks with choices, the right answer was always listed first. The choices are now in a plain order, and the site build refuses a set of self-checks where the right answer mostly sits in one place. * **Update**: A route shortened or filled by your answers now runs point by point: a tutorial added because you have time sits with its own point. The practice-data page now says what you set out to do when you mark it done. * **Update**: For a reader working in R, passing the skip-check for a point now leaves nothing to do on it. Since the change that keeps a finished tutorial on your route, the R version of a tutorial whose question you had just answered came back as something still to take. * **Update**: "Clear everything" now also forgets a self-check answered earlier in the same visit. Before, going back to that tutorial without reloading the page still showed the answer as right, although nothing was stored. Replacing your progress from a file does the same. * **Update**: A tutorial you have finished now stays on your route and keeps counting, even when you later pass the skip-check for its point or say you have used the portal or checked a dataset before. Before, answering the last self-check on "Use an AI agent" turned a finished route of three tutorials into two. * **Update**: Fixes for readers who answer "R" to "Where are you starting?". The R version of a tutorial now has its own stop on the pathway page, under the point it belongs to; its page names the pathway you are following and links to what comes next; and code in a self-check's explanation is shown as code. * **Creation**: Added [How AI was used](about/ai-disclosure.md), a statement of which parts of this site were drafted with an AI assistant and what a person has checked. * **Update**: Every tutorial's last line now says it was drafted with AI assistance and links to that page. The template, the contributing guide, the site footer, and `AGENTS.md` (rule 17) require the same of new pages. * **Update**: The [learning pathways](pathways/index.md) are much shorter. Each now opens with its essentials, 10 to 25 minutes, and lists the rest under "If you have more time". [Get ready for a hands-on session](pathways/get-ready-for-a-session.md) went from 13 tutorials and 70 to 90 minutes to 4 tutorials and 20 to 25 minutes: sign in, start an app, and load the practice data. It also says to do the first two at least two days ahead, because a new account must ask for access to apps. * **Creation**: With scripts on, the pathways page asks "Where are you starting?": what you are here for, whether you have used the portal, Python or R, whether you have checked a dataset before, and how long you have. The answers shorten your route, say what was left out and why, and stay in your browser. Nothing is locked. ## 2026-11-14 * **Update**: Accessibility pass. The pathway, tutorial, list, self-check and progress pages now pass an automated check at desktop width and at 320 pixels, and a whole pathway can be followed with the keyboard alone. The current tab and page are no longer marked in the bright accent, which was too faint at that size; code colours were darkened for the same reason; and the empty link before each line of a code block is gone. * **Update**: [Contribute a tutorial](contributing.md) now explains how to add a tutorial to a learning pathway and how to write a self-check. * **Creation**: Added fifteen [self-checks](pathways/self-checks.md), short questions whose answers come from doing a task, each with the likely slips explained. Twelve are confirmed against the practice data whenever the site is built; three are about portal screens and say so. With scripts on, a tutorial's self-check appears on its page, a point can be skipped by answering its questions, and each point ends with an optional reflection, which [Your progress](progress.md) can save as Markdown. * **Creation**: Added [Your progress](progress.md) and progress on the [learning pathways](pathways/index.md). With scripts on, a pathway is drawn as a path with a stop for each tutorial; a tutorial can be marked done, and each finished one says what it set out to do; [Tutorials](tutorials/index.md) and [Every tutorial, by pathway point](pathway.md) are drawn the same way. The record is kept only in the reader's browser, and can be saved to a file, brought back, and cleared. Every page still reads as plain lists with scripts off. * **Creation**: Added six [learning pathways](pathways/index.md), goal-based routes through the tutorials that each state their total time: [New to MESA](pathways/new-to-mesa.md), [Get ready for a hands-on session](pathways/get-ready-for-a-session.md), [Check a dataset before you trust it](pathways/check-a-dataset.md), [Work in R](pathways/work-in-r.md), [Use an AI agent and check what it says](pathways/use-an-ai-agent.md), and [Leave work others can rerun](pathways/leave-work-others-can-rerun.md). They are generated from `data/pathways.yml` by `scripts/gen_pathways.py`. * **Update**: [Every tutorial, by pathway point](pathway.md), formerly "Learning pathway", is now generated at the same address. It gives each tutorial's time, names what each point builds, and splits point 1 into the six tutorials a newcomer needs and five small groups of reference tutorials. The home page now opens on the pathways. ## 2026-11-13 * **Creation**: Added two tutorials on the portal's built-in viewers, each followed once on the live portal: [Read a notebook in the portal without starting an app](tutorials/view-a-notebook.md) and [Look inside a CSV file from the portal](tutorials/preview-a-table.md). * **Update**: Renamed, moved, trashed and restored a file on the live portal, and recorded that these work as they do for folders in [Rename a folder in your Data Store](tutorials/rename-a-folder.md), [Move folders into another folder](tutorials/move-folders.md), and [Move a folder to the trash and get it back](tutorials/trash-and-restore.md). * **Update**: Finished the run on a newly created account, once CyVerse had granted it access to interactive apps. All five MESA apps started. The Python tutorials' code (28 outputs) and the R tutorials' code (11 outputs) gave the printed results inside MESA JupyterLab and MESA RStudio Geospatial. Followed by hand: launching JupyterLab, saving a notebook, loading a file, Monitor and Extend Time, Save & Exit, loading a file in RStudio, and the Cloud Shell, VS Code and desktop tutorials. Small corrections for what a new account sees went into [Launch MESA JupyterLab with your Data Store mounted](tutorials/launch-jupyterlab.md), [Save your work where it survives the session](tutorials/save-your-work.md), [Check on a running app and give it more time](tutorials/monitor-and-extend.md), [Write and run a Python script in MESA VS Code](tutorials/vscode-run-a-script.md), [Open a file from your Data Store in a desktop program](tutorials/desktop-open-a-file.md), and [Check your CPU hours and storage](tutorials/check-your-usage.md). * **Creation**: Added four short portal tutorials, each followed once on the live portal: [Browse a large folder as a sorted list](tutorials/browse-a-large-folder.md), [Read the metadata on a folder shared with you](tutorials/read-shared-metadata.md), [Stop sharing a folder](tutorials/stop-sharing-a-folder.md), and [Check your CPU hours and storage](tutorials/check-your-usage.md). * **Creation**: Added three file-handling tutorials, each followed once on the live portal with folders: [Rename a folder in your Data Store](tutorials/rename-a-folder.md), [Move folders into another folder](tutorials/move-folders.md), and [Move a folder to the trash and get it back](tutorials/trash-and-restore.md). * **Update**: Checked [Share a folder with a collaborator](tutorials/share-a-folder.md) from a second account. **User Shared** lists a folder for each user, so the check now says how the collaborator finds yours and what read-only access looks like. * **Update**: Began a run of the tutorials on a new CyVerse account. A new account cannot start an app until CyVerse grants access to interactive apps, so [Launch MESA JupyterLab with your Data Store mounted](tutorials/launch-jupyterlab.md) now says what the failed launch looks like and how to ask for access. [Share a folder with a collaborator](tutorials/share-a-folder.md) now describes the match line and the wait after **Share**. * **Creation**: Added two tutorials to pathway point 5, followed in MESA JupyterLab: [Write a README for a data folder](tutorials/write-a-readme.md) and [Record the software versions a result depends on](tutorials/record-software-versions.md). * **Creation**: Added a first tutorial for each of the remaining MESA apps, each followed once in the app: [Download a file from the web into your Data Store with MESA Cloud Shell](tutorials/cloud-shell-download.md), [Write and run a Python script in MESA VS Code](tutorials/vscode-run-a-script.md), and [Open a file from your Data Store in a desktop program](tutorials/desktop-open-a-file.md). * **Update**: Closed gaps in today's tutorials after a second pass on the live portal. The R tutorials were followed one step at a time in MESA RStudio Geospatial. In [Search for a file or folder by name](tutorials/search-the-data-browser.md) every step is now one that was clicked, with its own screenshot and a note on searching after you open a result. `scripts/check_tutorial_outputs.R` checks the R tutorials' printed output, and the build workflow runs it in the MESA RStudio image. * **Creation**: Added an R track for MESA RStudio Geospatial, run in the app: [Load a file from your Data Store in RStudio](tutorials/r-load-a-file.md), [Tally a quality flag in R](tutorials/r-tally-a-quality-flag.md), and [Query a Parquet file with DuckDB from R](tutorials/r-query-parquet-with-duckdb.md). * **Creation**: Added four portal tutorials, each followed once on the live portal: [Make a folder in your Data Store](tutorials/make-a-folder.md), [Search for a file or folder by name](tutorials/search-the-data-browser.md), [Launch an app with the cores, memory, and time you choose](tutorials/launch-with-options.md), and [Check on a running app and give it more time](tutorials/monitor-and-extend.md). Tutorials on uploading a file and relaunching an app were not written, because both actions failed on the portal that day. * **Creation**: Added [Map point data with sf in MESA RStudio Geospatial](tutorials/map-points-in-rstudio.md), the first tutorial for that app, run there on 2026-11-13. The [practice data](tutorials/practice-data.md) gained `gauge_sites.csv`, invented coordinates for the five gauges. * **Update**: Ran every data tutorial's code inside MESA JupyterLab (pandas 3.1.1, DuckDB 2.0.0): all 28 printed outputs matched, and the four newest tutorials ran without error as notebooks. Their notices now say so. They remain drafts until a person follows the steps by hand. * **Creation**: Added the [Learning pathway](pathway.md), which arranges every tutorial under the five pathway points, and four draft tutorials: [Turn UTC timestamps into local days](tutorials/local-days-from-utc.md), [Work with a long table, one row per kind of measurement](tutorials/work-with-a-long-table.md), [Query a Parquet file with DuckDB from a notebook](tutorials/query-parquet-with-duckdb.md), and [Check an AI-suggested result against the data](tutorials/check-a-suggested-result.md). * **Update**: The [practice data](tutorials/practice-data.md) gained a third file, `observations.csv`: a week of hourly rain and air temperature from one gauge, in long format with UTC timestamps. `scripts/check_tutorial_outputs.py` now runs every tutorial's code against the practice data and compares it with the output on the page; the build workflow runs it on every pull request. ## 2026-11-12 * **Update**: [Launch MESA JupyterLab](tutorials/launch-jupyterlab.md) again describes the launch page in a new tab. The **Launching Application** window is what the portal shows when the browser blocks that tab, and is now the tutorial's recovery case. * **Update**: Corrected the tutorials after a first pass on the live portal and in MESA JupyterLab (pandas 3.1.1): `~/data-store` holds `data` and `home`, and your files are in `home/`; a new notebook asks for a kernel and does not offer Python first; **Save & Exit** asks for confirmation; the share dialog's levels are **Read**, **Read & Write**, and **Full Control**; the theme button cycles **Light**, **Dark**, **System**. After **Save & Exit** the analysis is under **Completed Analyses**, which is collapsed; **View Results** opens an empty output folder for an interactive app, where the portal may show **Unable to Load Files**. All tutorials remain drafts. * **Creation**: Added five draft tutorials written from the MESA documentation: [Find your way around the MESA Portal](tutorials/find-your-way-around.md), [Share a folder with a collaborator](tutorials/share-a-folder.md), [Add metadata to a file or folder](tutorials/add-metadata.md), [Sign in and start an AI agent in a MESA app](tutorials/start-an-ai-agent.md), and [Keep tokens and passwords out of saved files](tutorials/keep-secrets-out-of-files.md). None has been validated on the live portal. * **Creation**: Added the [practice data](tutorials/practice-data.md), two small synthetic rain-gauge files with a data dictionary (made by `scripts/make_practice_data.py`), and seven draft data tutorials that use it: [Load a file from your Data Store into a notebook](tutorials/load-a-file.md), [Read the data dictionary before the data](tutorials/read-the-data-dictionary.md), [Check a column's range and missing values](tutorials/check-range-and-missing.md), [Tally a quality flag before you trust a number](tutorials/tally-a-quality-flag.md), [Count records per day to find incomplete days](tutorials/count-records-per-day.md), [Reconcile row counts before and after a join](tutorials/reconcile-a-join.md), and [Leave a notebook someone else can rerun](tutorials/leave-a-rerunnable-notebook.md). The code was run with pandas 3.1 on a laptop; none has been validated in MESA JupyterLab. ## 2026-11-11 * **Creation**: Scaffolded the MESA Trainings site: the [home page](index.md), the [tutorial template](template.md), [Contribute a tutorial](contributing.md), the [license](about/license.md) page (CC BY 4.0 for content, BSD 3-Clause for code), and [For AI agents](about/ai-agents.md). The build, validation, and agent-surface scripts come from idss-mesa/docs. * **Creation**: Added the first five tutorials, all drafts written from the MESA documentation and not yet validated on the live portal: [Sign in to the MESA Portal with a CyVerse account](tutorials/sign-in.md), [Find MESA's community data in the Data Browser](tutorials/find-community-data.md), [Launch MESA JupyterLab with your Data Store mounted](tutorials/launch-jupyterlab.md), [Save your work where it survives the session](tutorials/save-your-work.md), and [Stop an app and find your results](tutorials/stop-app-find-results.md).