Skip to content

Commit 1f88637

Browse files
committed
Added file upload instructions
1 parent bc4e111 commit 1f88637

3 files changed

Lines changed: 53 additions & 2 deletions

File tree

CH40208/_toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ parts:
119119
- caption: Planning Your Code
120120
chapters:
121121
- file: code_schematics/code_schematics.md
122-
122+
- caption: Reference
123+
chapters:
124+
- file: reference/adding_files_to_noteable.md
123125
- caption: Exercise Worked Examples
124126
chapters:
125127
- file: worked_examples/week_1_index
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Adding Files to Noteable
2+
3+
When working with data files (such as CSV files containing experimental results), you need to get those files into your Noteable environment before you can read them with Python.
4+
5+
## Uploading Files from Your Computer
6+
7+
To upload a file from your computer to Noteable:
8+
9+
1. Click the upload button (↑ icon) in the toolbar at the top of the file browser
10+
2. Select the file from your computer
11+
3. The file will appear in your current directory
12+
13+
**Alternative method:** You can also drag and drop files directly from your computer into the Noteable file browser.
14+
```{note}
15+
Make note of which directory your file is uploaded to. You'll need to use this path when reading the file in Python.
16+
```
17+
18+
## Downloading Files from the Internet
19+
20+
If you have a direct URL to a data file (for example, a CSV file hosted on GitHub), you can download it directly into Noteable:
21+
22+
1. Go to **File > Open from URL...**
23+
2. Paste the URL of the file
24+
3. Click **Open**
25+
26+
The file will be downloaded to your current directory.
27+
28+
### Example URLs
29+
30+
For CSV files on GitHub, make sure to use the "raw" URL. For example:
31+
- Wrong: `https://github.com/user/repo/blob/main/data.csv`
32+
- Correct: `https://raw.githubusercontent.com/user/repo/main/data.csv`
33+
34+
## Finding Your Files
35+
36+
Once uploaded or downloaded, files appear in the file browser on the left side of the Noteable interface. To use a file in your Python code, you reference it by its filename (if it's in the same directory as your notebook) or by its path.
37+
```python
38+
import numpy as np
39+
40+
# If the file is in the same directory as your notebook:
41+
data = np.loadtxt('mydata.csv', delimiter=',')
42+
43+
# If the file is in a subdirectory:
44+
data = np.loadtxt('data/mydata.csv', delimiter=',')
45+
```

CH40208/working_with_data/synoptic_exercises.ipynb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
"\n",
1818
"You have been provided with an experimental pressure/volume isotherm for SF<sub>6</sub> at 298 K in the form of a [csv file](https://raw.githubusercontent.com/pythoninchemistry/ch12004/main/CH12004/lab_5/isotherm.csv).\n",
1919
"\n",
20+
"```{note}\n",
21+
"If you need help uploading data files from your own computer or the internet to Noteable, see [Adding Files to Noteable](../reference/adding_files_to_noteable.md).\n",
22+
"```\n",
23+
"\n",
2024
"a) Read in the experimental data using `numpy` and plot the isotherm using `matplotlib`.\n",
2125
"\n",
2226
"b) Assuming ideality, the isotherm should be well modelled by the ideal gas law:\n",
@@ -85,7 +89,7 @@
8589
"name": "python",
8690
"nbconvert_exporter": "python",
8791
"pygments_lexer": "ipython3",
88-
"version": "3.11.1"
92+
"version": "3.12.3"
8993
}
9094
},
9195
"nbformat": 4,

0 commit comments

Comments
 (0)