From 8647f9f1828765118dedc891fa13c88244341af2 Mon Sep 17 00:00:00 2001 From: hjolson01 <52801045+hjolson01@users.noreply.github.com> Date: Thu, 18 Mar 2021 12:54:59 -0500 Subject: [PATCH 1/3] Update README.md --- s21/p5/README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/s21/p5/README.md b/s21/p5/README.md index 32c7405..2cd0043 100644 --- a/s21/p5/README.md +++ b/s21/p5/README.md @@ -570,8 +570,32 @@ The output `geo_output.svg` will look like -### 5. TBD +Here we are going to create an animation. +Imagine running geohour for all hours of the day, then combining the images to make a video. That's basically what this command does. + +We'll be using FuncAnimation to create the video, then call .to_html5_video(...), which is why we have .html in the video's file name. + +This last part needs a (non-Python) package called ffmpeg to convert all the images into a video/animation/html file. Install it like so: + +```sudo apt-get install ffmpeg``` + +Here is the starter code. You will need to update the update function, making sure to use plot_hour to plot a specific hour. After, you will create a video using the FuncAnimation function. For the func parameter of FuncAnimation, we will use the update function object. +Make sure to use the function object, we do not call the function. +Example: (object: function_example vs calling: function_example() --> (FuncAnimation(…, func_example, …), not FuncAnimation(…, func_example(), …))) + +The final thing should look something like [this](https://tyler.caraza-harter.com/cs320/s20/materials/p4-vid.html). + +```@click.command() + @click.argument('zipname') + @click.argument('vidname') + def video(zipname, vidname): + fig, ax = plt.subplots() + def update(hour): + # todo: use plot_hour function to create a graph for a specific hour + # Use FuncAnimation function to create a video + with open(vidname, "w") as f: + f.write(your_video_name_here.to_html5_video())``` ## Hand-In From 2336bc2ca3721e6bfc755750adf6ea3b36b298fa Mon Sep 17 00:00:00 2001 From: hjolson01 <52801045+hjolson01@users.noreply.github.com> Date: Thu, 18 Mar 2021 12:56:33 -0500 Subject: [PATCH 2/3] Update README.md --- s21/p5/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/s21/p5/README.md b/s21/p5/README.md index 2cd0043..b3b89e5 100644 --- a/s21/p5/README.md +++ b/s21/p5/README.md @@ -570,6 +570,8 @@ The output `geo_output.svg` will look like +### 5. `Video` Command + Here we are going to create an animation. Imagine running geohour for all hours of the day, then combining the images to make a video. That's basically what this command does. From 59cf4933e9c85d2041069a557d0beb3ffc5bb36c Mon Sep 17 00:00:00 2001 From: hjolson01 <52801045+hjolson01@users.noreply.github.com> Date: Thu, 18 Mar 2021 12:58:27 -0500 Subject: [PATCH 3/3] Update README.md --- s21/p5/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/s21/p5/README.md b/s21/p5/README.md index b3b89e5..49e9d36 100644 --- a/s21/p5/README.md +++ b/s21/p5/README.md @@ -586,8 +586,6 @@ Here is the starter code. You will need to update the update function, making su Make sure to use the function object, we do not call the function. Example: (object: function_example vs calling: function_example() --> (FuncAnimation(…, func_example, …), not FuncAnimation(…, func_example(), …))) -The final thing should look something like [this](https://tyler.caraza-harter.com/cs320/s20/materials/p4-vid.html). - ```@click.command() @click.argument('zipname') @click.argument('vidname') @@ -597,8 +595,10 @@ The final thing should look something like [this](https://tyler.caraza-harter.co # todo: use plot_hour function to create a graph for a specific hour # Use FuncAnimation function to create a video with open(vidname, "w") as f: - f.write(your_video_name_here.to_html5_video())``` + f.write(your_video_name_here.to_html5_video()) +``` +The final thing should look something like [this](https://tyler.caraza-harter.com/cs320/s20/materials/p4-vid.html). ## Hand-In Your main.py is your deliverable for P5.