-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1_Status_Report_News.Rmd
119 lines (79 loc) · 4.05 KB
/
1_Status_Report_News.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
title: "What's New With Status Reports?"
author: "Dave Eslinger and Kim Cressman"
date: "11/18/2019"
output: ioslides_presentation
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(SWMPrExtension)
path <- './data'
qaFlags <- c('0', '3', '5')
```
## SWMP Status Report Update
- 2018 data has been processed and all graphics are available at CDMO:
http://cdmo.baruch.sc.edu/waf/nerrs_swamp_status_reports/
- However, these reports use the old Excel content and R scripts.
That means:
- **Graphs** all scale with 0. as their lowest Y-value.
- **Graphs** all use non-metric units.
- The text and pictures are all from the old, boiler-plate 2016 product.
Graphs, units, and pictures **_may_** need updating, the **text**, at least, **must** be updated.
## SWMP Status Report Update (cont.)
- New version (1.1.2) of SWMPrExtension on CRAN
- New capability to enter flags to auto-scale y-axis
- Bug fixes in Status Report scripts and SWMPrExtension
- For using metric units
- With seasonal_dot.R for annotating regression results
## Issue: Y-Axis Scale Fixed to 0
```{r scale_problem, warning=FALSE, out.width='55%', fig.align='center' }
df <- import_local(path,'jobjbmet2017')
df <- qaqc(df, qaqc_keep = qaFlags)
raw_boxplot(df, param = 'atemp', plot_title = TRUE, target_yr = '2017', free_y = FALSE)
raw_boxplot(df, param = 'bp', plot_title = TRUE, target_yr = '2017', free_y = FALSE)
```
## Solution: Autoscale Y-Axis
```{r scale_solution, warning=FALSE, out.width='55%', fig.align='center' }
#df <- import_local(path,'jobjbmet2017')
#df <- qaqc(df, qaqc_keep = qaFlags)
raw_boxplot(df, param = 'atemp', plot_title = TRUE, target_yr = '2017', free_y = TRUE)
raw_boxplot(df, param = 'bp', plot_title = TRUE, target_yr = '2017', free_y = TRUE)
```
## How? Flag for `free_y`
- New flag in Excel spreadsheet to specify how y-axis scaling should work,
and the SWMPrExtension package code updated to use the new flag.
```{r rstudio, out.width='95%', fig.align='center'}
knitr::include_graphics('./images/Free_Y_excel.png')
```
## The Details
<div style= "float:right; position: relative; top: 0px;">
```{r details, out.width='100%', fig.align='center', out.extra='style="float:right; padding:0px"'}
knitr::include_graphics('./images/Free_Y_small.png')
```
</div>
- Create `Free_Y` entry in column F (the sixth one) on *Basic Plotting* tab of the **Reserve_Level_Plotting_Variables.xlsx** spreadsheet.
- **T** for **TRUE**: sets lower y-axis bound by the data range.
- **F** for **FALSE**: sets lower y-axis bound to **0.0**.
- Set for each variable.
- Default is **FALSE**, so that is what you get if you don't add the column at all.
## Note: Previous behaviour was not a problem when data set included negative values
`free_y = TRUE` left, `free_y = FALSE`, right
```{r scale_no_problem, warning=FALSE, out.width='50%', fig.show='hold' }
df <- import_local(path,'lkspomet2018')
df <- qaqc(df, qaqc_keep = qaFlags)
raw_boxplot(df, param = 'atemp', plot_title = TRUE, target_yr = '2018', free_y = TRUE)
raw_boxplot(df, param = 'atemp', plot_title = TRUE, target_yr = '2018', free_y = FALSE)
```
## Other News: Bug fixes
- Fixed font error in `seasonal-dot.R` that stopped the routine that automatically produced all plots in one swell foop.
- This error was introduced in a recent R update, so you may not have seen it.
- Fixed the conversion to metric units to work for all variables.
## How to get all this goodness?
- Update your SWMPrExtension from the CRAN repo
- Modify your **Reserve_Level_Plotting_Variables.xlsx** to add the `Free_Y` parameter
- It is in the **figure_files** directory of your status report project.
- Download an example from https://bit.ly/2NSOqH7
- Download a revised R directory from: https://bit.ly/2r0RGqW
- Unzip it and replace the files in the **R** directory of your status report project.
Hmmm, I think that is it. Modify your spreadsheets, and go for it!
All questions to dave.eslinger@noaa.gov. Thanks!