Version control exercises 6-9 assume that you have an instructor adding and
modifying files in your repository. The files are available in the
data
and
code
directories of
the course repository.
You’re working on a large project trying to predict diversity hotspots. Another member of your collaborative team has produced a series of files that contain lists of areas that resulted from a series of modeling exercises. Each filename begins with the word area.
Your programmer has whipped up a small python script called rich_pred.py
that
takes a single file containing a list of areas, one per line, and returns the
area and the predicted richness.
Your team is using version control and all of the relevant files are
in the repository. Navigate to the main working directory for your repository
and update it from the command line using git pull
. This will place the
necessary files in your main directory. Move the files into the directory you
created for this assignment by using git mv filename new_location
, commit
this change with an appropriate commit message, and push them back to the
central repository.
This is a follow up question to Version Control 6.
Your job is to take all of these files, run them through the python code and
produce a single list of the areas and associated richness predictions from all
of the sites combined. This list should be sorted from the smallest area to the
largest area, should only include unique values, and should be stored to a file
called predicted_diversities.txt
. You could cut and paste the files together,
run them through the Python code, and then do some post processing to get the
list looking right, but new files are going to be showing up constantly, and
besides, this can be readily accomplished in one line using the shell. You could
use a loop, but since you just need a single list of areas and predictions it’s
probably easier to just use cat
to concatenate all of the files at the
beginning. Once you’ve figured out the necessary shell commands put them in a
text file and save it as predict_richness.sh
. Test to make sure everything is
working by running it using the command bash predict_richness.sh
. Commit the
new shell program and the resulting data file to the repository.
This is a follow up question to Version Control 7.
You’re working late and you sit down to edit predict_richness.sh
. You open the
file in your editor, reach for your cup of coffee, knock it over onto your
computer and in all of the excitement somehow delete the contents of the file
and save it (go ahead, open it, delete the contents, press save). Not to worry,
you’re using version control. Take a deep breath, dry off your computer, revert
the changes using git checkout
, and reflect on how using version control makes
you just like Superman in Superman 1 because it’s like you made time go
backwards.
This is a follow up question to Version Control 8.
A colleague emails you to let you know that you need to change some of the
parameter values that are being used in rich_pred.py
. Go to the line that
defines sar_parameters
and change it to
sar_parameters = [[22.7, 0.3], [1.2, 0.163, 0.009],
[14.36, 21.16], [85.91, 42.57],
[1082.45, 1.59, 390000000]]
Now, follow these instructions carefully: