In this exercise you will install DeepSeek Harness (DSH), connect it to a DeepSeek model with your own API key, and send your first message. We use an API key instead of logging in with an account, because it makes it easy to switch models later and works the same way across tools. Everything in the rest of this lab depends on this step, so make sure following steps work before you move on.
1.1 Download and install DeepSeek Harness, then launch it.
1.2 Create an account on the DeepSeek Platform and top up 10 RMB.
1.3 Create an API key at platform.deepseek.com/api_keys and copy it.
Treat the key like a password, do not commit it to Git, do not share it, and do not put it in a screenshot you send to anyone.
1.4 In DeepSeek Harness, open Settings, add your API key under the model or account settings, and select any chat model from the list. Model names change between versions, so just pick the default or the first chat model.
1.5 Choose where the agent works. Create a new
folder AI4coding. Set the working directory to the folder.
Before you do anything else, select the option to modify only
within the workspace, so the agent can only edit files inside
that folder and cannot touch anything outside it.
1.6 Ask DSH to create a Git repository in this folder, so you can commit your work in the following exercises.
1.7 Open a new session and ask it: What is
xarray? Confirm you get a reply. Then find where token
usage is shown and note roughly how many tokens your exchange used.
] Now that DeepSeek Harness is set up, use it for your first real
task: read ozone_data.csv
and plot the Ozone column. The point is not just to get a
plot, but to practice three things: describe the task clearly, point DSH
to your file, and check its work.
2.1 Put ozone_data.csv in the working
directory you chose in 1.5.
2.2 Open a new session and describe the task to DSH
in your own words. Your description should state the goal (read
ozone_data.csv and plot the Ozone column
against its index), the output (save the figure as
ozone_plot.png), and the details (a title and axis labels).
A clear description works much better than a vague one.
2.3 Point DSH to the file with
@ozone_data.csv, so it knows which file to use.
2.4 Watch what DSH does. It reads the file, writes code, runs it, and if something fails, reads the error and tries again. Write down one thing it did that you did not ask for.
2.5 Open ozone_plot.png and check the
plot looks right, comparing with the ozone plots you made in Section
08.
2.6 Now check the numbers. Ask DSH to print
ozone_data.shape and
ozone_data['Ozone'].head(), and verify.
In question 2 you made DSH plot Ozone. Now you will ask
it to change that script, and for the first time you will review what it
changed before you accept it. Reviewing changes is how you stay in
control of AI-written code.
3.1 Continue in the same session, ask DSH to add
Temperature to the plot as a second line on the right
y-axis, with its own axis label and a matching color. Describe what you
want in your own words.
3.2 Before you accept anything, review the change. Open the updated script and compare it with what you had before. What did it change, and did it change anything you did not ask for?
3.3 Run it and verify. Both Ozone (left
axis, in ppb) and Temperature (right axis, in F) appear,
with sensible ranges (roughly 0 to 200 for
Ozone, 50 to 100 for
Temperature).
3.4 If anything is wrong, tell DSH what to fix and review the change again.
NetCDF, xarray, and area weightingYou will read sst.mnmean.nc used in Lab 08 and
compute the correct global monthly mean sea surface temperature. Make
sure sst.mnmean.nc is still in your working directory; if
you deleted it, download it again. This task has a classic trap that the
obvious way to average a global map is wrong, and AI code often gets it
wrong while looking perfectly fine.
4.1 Turn on plan mode first. Type
/plan in the input box (or /plan followed by
your goal, which enters plan mode with that instruction). DSH will then
explore and write out a plan for your approval. Read the plan and check
whether it mentions area weighting (something like weights
proportional to the cosine of latitude). If it does not, ask DSH to
revise before you approve the plan.
4.2 Approve the plan and let DSH carry it out. Read
sst.mnmean.nc with xarray, and compute and
plot the correct global monthly mean sea surface temperature (SST) from
1854-01 to 2022-10, using area weights
proportional to the cosine of latitude.
4.3 Compare your figure with
corrected_SST.png from Lab 08. They
should match.
4.4 Ask DSH to also compute the unweighted global mean and compare. The unweighted mean over-weights the cold poles, so the weighted curve should be higher.