Skip to content

Commit 51428fa

Browse files
authored
Merge pull request #10 from Resourcecode-project/rm-latex2exp
Remove dependency on latex2exp
2 parents 84074f6 + 0d615ee commit 51428fa

26 files changed

+574369
-108
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ docs
99
rscd.png
1010
resourcecode_logo.png
1111
logos
12-
*.svg
1312
inst/doc
1413
/doc/
1514
/Meta/
16-
/tests/testthat/_snaps/
1715
cran-comments.md

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Imports:
2727
grid,
2828
gridtext,
2929
jsonlite,
30-
latex2exp,
3130
lubridate,
3231
ncdf4,
3332
patchwork,

R/orbital_speed.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ compute_orbital_speeds <- function(
7171
out <- array(NA, dim = c(dim(spectral_u_component), 2))
7272
out[, , 1] <- spectral_u_component
7373
out[, , 2] <- spectral_v_component
74-
return(out)
74+
out
7575
} else {
7676
u_rms <- sqrt(2 * resourcecode::fastTrapz(freq, spectral_u_component, 2))
7777
v_rms <- sqrt(2 * resourcecode::fastTrapz(freq, spectral_v_component, 2))
78-
return(cbind(u_rms, v_rms))
78+
cbind(u_rms, v_rms)
7979
}
8080
}

R/specta_data_ploting.R

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
#' theme_linedraw coord_polar scale_color_distiller scale_fill_distiller
1717
#' labs expansion
1818
plot_2d_specta <- function(
19-
spec,
20-
time = 1L,
21-
normalize = TRUE,
22-
trim = 0.01,
23-
cut_off = 0.4,
24-
...) {
19+
spec,
20+
time = 1L,
21+
normalize = TRUE,
22+
trim = 0.01,
23+
cut_off = 0.4,
24+
...
25+
) {
2526
if (is.character(time)) {
2627
time <- as.POSIXct(time, tz = "UTC")
2728
}
@@ -118,10 +119,11 @@ plot_2d_specta <- function(
118119
#' theme_linedraw
119120
#' labs expansion
120121
plot_1d_specta <- function(
121-
spec,
122-
time = 1L,
123-
print_sea_state = TRUE,
124-
...) {
122+
spec,
123+
time = 1L,
124+
print_sea_state = TRUE,
125+
...
126+
) {
125127
if (is.character(time)) {
126128
time <- as.POSIXct(time, tz = "UTC")
127129
}
@@ -131,7 +133,9 @@ plot_1d_specta <- function(
131133
}
132134

133135
if ("freq" %nin% names(spec)) {
134-
warning("Frequency vector not provided: using the default Resourcecode frequency vector.")
136+
warning(
137+
"Frequency vector not provided: using the default Resourcecode frequency vector."
138+
)
135139
freq_plot <- rscd_freq
136140
} else {
137141
freq_plot <- spec$freq
@@ -154,7 +158,7 @@ plot_1d_specta <- function(
154158
expand = FALSE
155159
) +
156160
scale_y_continuous(
157-
name = latex2exp::TeX("Wave spectral density ($m^2s)"),
161+
name = "Wave spectral density (m^2.s)",
158162
expand = expansion(c(0, .01), c(0, .05))
159163
) +
160164
labs(
@@ -163,12 +167,24 @@ plot_1d_specta <- function(
163167
caption = "Source: Resourcecode hindcast database\nresourcecode.ifremer.fr"
164168
)
165169
if (print_sea_state) {
166-
text <- paste0("**Sea-state parameters:**\n
167-
Hs=", round(spec$forcings$hs[time], 2), "m<br>
168-
Tp=", round(1 / spec$forcings$fp[time], 2), "s<br>
169-
Dir=", round(spec$forcings$dir[time], 2), "\u00b0<br>
170-
Wspd=", round(spec$forcings$wnd[time], 2), "m/s<br>
171-
Wdir=", round(spec$forcings$wnddir[time], 2), "\u00b0<br>")
170+
text <- paste0(
171+
"**Sea-state parameters:**\n
172+
Hs=",
173+
round(spec$forcings$hs[time], 2),
174+
"m<br>
175+
Tp=",
176+
round(1 / spec$forcings$fp[time], 2),
177+
"s<br>
178+
Dir=",
179+
round(spec$forcings$dir[time], 2),
180+
"\u00b0<br>
181+
Wspd=",
182+
round(spec$forcings$wnd[time], 2),
183+
"m/s<br>
184+
Wdir=",
185+
round(spec$forcings$wnddir[time], 2),
186+
"\u00b0<br>"
187+
)
172188

173189
out_plot <- out_plot +
174190
patchwork::inset_element(
@@ -182,7 +198,7 @@ Wdir=", round(spec$forcings$wnddir[time], 2), "\u00b0<br>")
182198
left = 0.7,
183199
bottom = 0.77,
184200
right = .95,
185-
top = .99
201+
top = .95
186202
)
187203
}
188204
out_plot

R/spectral_data_download.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ get_2d_spectrum <- function(point, start = "1994-01-01", end = "1994-02-28") {
281281
out$forcings <- rbind(out$forcings, temp$forcings)
282282
}
283283

284-
return(out)
284+
out
285285
}
286286

287287

@@ -388,5 +388,5 @@ get_1d_spectrum <- function(point, start = "1994-01-01", end = "1994-02-28") {
388388
out$forcings <- rbind(out$forcings, temp$forcings)
389389
}
390390

391-
return(out)
391+
out
392392
}

0 commit comments

Comments
 (0)