CalCOFI / apps

Shiny app demo for CalCOFI
https://calcofi.io
MIT License
0 stars 0 forks source link

Oceano app: Time series error #17

Closed bbest closed 1 year ago

bbest commented 1 year ago

From @evsatt:

image

Hey Ben and Marina, I hope you are well :) I was just showing the OPC Offshore winds person our app, as they would like to use it for looking at trends in the wind call area over time. But I can't figure out why it won't generate a time series graph. Do you have thoughts on if this is user error or if there is something with permissions going on on the backend? Thanks! Erin

with Temperature for defined SoCal area and Depth 0-515 m

bbest commented 1 year ago

Look at server log

Debug by hopping on as user bebest:

https://rstudio.calcofi.io

And checking out logs:

# change directory to Shiny logs
cd /var/log/shiny-server

# list all with time reversed
ls -latr
-rw-r----- 1 shiny staff  4748 Aug 14 18:56 oceano-shiny-20230814-182236-38493.log
# page through last file with spacebar to advance
more oceano-shiny-20230814-182236-38493.log
su: ignoring --preserve-environment, it's mutually exclusive with --login
Loading required package: librarian
Warning in CPL_transform(x, crs, aoi, pipeline, reverse, desired_accuracy,  :
  GDAL Error 1: PROJ: proj_as_wkt: DatumEnsemble can only be exported to WKT2:2019

Listening on http://127.0.0.1:38493
Warning: Error in [.xts: subscript out of bounds
  108: stop
  107: [.xts
  104: start.xts
  101: defaultPeriodicity
  100: dygraph
   99: dySeries
   98: %>%
   97: ::
htmlwidgets

...

Warning: Error in str_replace: could not find function "str_replace"
  114: <reactive:get_ts_data> [/share/github/apps/oceano/server.R#417]
   98: get_ts_data
   97: ::
htmlwidgets
shinyRenderWidget [/share/github/apps/oceano/server.R#441]
   96: func
   83: renderFunc
   82: output$plot_ts
    1: runApp

Ok, seems to be a problem with the plotting, perhaps data missing, per .xts: subscript out of bounds; or the library stringr not getting loaded since not finding str_replace().

bbest commented 1 year ago

Prep dev branch for debug

bbest commented 1 year ago

Debug app

Set browser() in oceano/server.R around plot_ts just before dygraph plotting:

https://github.com/CalCOFI/apps/blob/55902d260ab3a09712528e685293f915c65b80e0/oceano/server.R#L438C5-L457

bbest commented 1 year ago

Trying first in RStudio with Run App button. Initially the app works in the Time series tab, but changing to a similar custom Area produces a more useful error:

- Error: could not find function "str_replace"
bbest commented 1 year ago

https://github.com/CalCOFI/apps/blob/55902d260ab3a09712528e685293f915c65b80e0/oceano/server.R#L408-L418

bbest commented 1 year ago

From @evsatt:

Weird -- its still throwing an error...

- An error has occurred. Check your logs or contact the app author for clarification.
bbest commented 1 year ago

Whoops, I forgot to update the main apps folder (vs apps_dev) that gets served at shiny.calcofi.io/oceano, which I did with the following commands in the Terminal of rstudio.calcofi.io:

# change directory to the main apps folder
cd /share/github/apps

# pull the latest from Github
git pull

# touch the file (to give newer timestamp) that tells Shiny server to reload the app in oceano/
touch oceano/restart.txt