Skip to content
Snippets Groups Projects
Commit b8e82818 authored by Blodgett, David L.'s avatar Blodgett, David L.
Browse files

get_data script and notebook have ipymd installed still need to figure out how it works.

parent e42d60bc
No related branches found
No related tags found
1 merge request!3Docker and data getter script
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
workspace/temp_data workspace/temp_data
workspace/.ipynb_checkpoints workspace/.ipynb_checkpoints
workspace/data workspace/data
.Rproj.user
*.Rhistory
...@@ -50,4 +50,13 @@ RUN apt-get -y install \ ...@@ -50,4 +50,13 @@ RUN apt-get -y install \
$(lsb_release -cs) \ $(lsb_release -cs) \
stable" && \ stable" && \
apt-get -y install docker-ce docker-ce-cli containerd.io apt-get -y install docker-ce docker-ce-cli containerd.io
\ No newline at end of file USER root
RUN wget http://sslhelp.doi.net/docs/DOIRootCA2.cer -O /usr/local/share/ca-certificates/DOIRootCA2.crt && \
chmod 644 /usr/local/share/ca-certificates/DOIRootCA2.crt && update-ca-certificates
RUN Rscript -e 'install.packages("sbtools",repos="https://owi.usgs.gov/R")'
RUN pip --cert /usr/local/share/ca-certificates/DOIRootCA2.crt install ipymd && \
pip --cert /usr/local/share/ca-certificates/DOIRootCA2.crt install git+https://github.com/eea/odfpy
...@@ -2,7 +2,7 @@ version: '3' ...@@ -2,7 +2,7 @@ version: '3'
services: services:
wbeep: wbeep:
image: dblodgett/gfv2:v0.1 image: dblodgett/gfv2:v0.2
# build: . # build: .
container_name: gfv2 container_name: gfv2
user: root user: root
...@@ -12,5 +12,5 @@ services: ...@@ -12,5 +12,5 @@ services:
- ./workspace:/jupyter - ./workspace:/jupyter
command: > command: >
sh -c "usermod -a -G docker jovyan && sh -c "usermod -a -G docker jovyan &&
start.sh jupyter lab --LabApp.token='' --ContentsManager.root_dir='/jupyter'" start.sh jupyter lab --LabApp.token='' --ContentsManager.root_dir='/jupyter' --NotebookApp.notebook_dir='/jupyter' --NotebookApp.contents_manager_class='ipymd.IPymdContentsManager'"
\ No newline at end of file
library(sbtools)
library(nhdplusTools)
data_dir <- "data"
hu12_points_path <- file.path(data_dir, "hu_points.gpkg")
if(!file.exists(hu12_points_path)) {
if(is.null(sbtools::current_session()))
sb <- authenticate_sb()
sbtools::item_file_download("5dbc53d4e4b06957974eddae", names = "hu_points.gpkg",
destinations = hu12_points_path, session = sb)
}
gagesiii_points_path <- file.path(data_dir, "GAGESIII_gages")
if(!file.exists(gagesiii_points_path)) {
dir.create(gagesiii_points_path, recursive = TRUE, showWarnings = FALSE)
if(is.null(sbtools::current_session()))
authenticate_sb()
g3z <- "GAGESIII_gages.zip"
sbtools::item_file_download("5dbc53d4e4b06957974eddae", names = g3z,
destinations = file.path(gagesiii_points_path, g3z))
unzip(file.path(gagesiii_points_path, g3z), exdir = gagesiii_points_path)
rm(g3z)
}
nhdplus_dir <- file.path(data_dir, "NHDPlusNationalData")
if(!file.exists(nhdplus_dir)) {
nhdplus_gdb <- download_nhdplusv2(data_dir)
nhdplus_path(nhdplus_gdb)
staged_nhdplus <- stage_national_data()
}
%% Cell type:code id: tags:
``` R
source("get_data.R")
```
%% Output
USGS Support Package: https://owi.usgs.gov/R/packages.html#support
%% Cell type:code id: tags:
``` R
ls()
```
%% Output
1. 'data_dir'
2. 'gagesiii_points_path'
3. 'hu12_points_path'
4. 'nhdplus_dir'
\begin{enumerate*}
\item 'data\_dir'
\item 'gagesiii\_points\_path'
\item 'hu12\_points\_path'
\item 'nhdplus\_dir'
\end{enumerate*}
%% Cell type:code id: tags:
``` R
data_dir
gagesiii_points_path
hu12_points_path
nhdplus_dir
```
%% Output
'data'
'data'
'data/GAGESIII_gages'
'data/GAGESIII\_gages'
'data/hu_points.gpkg'
'data/hu\_points.gpkg'
'data/NHDPlusNationalData'
'data/NHDPlusNationalData'
%% Cell type:code id: tags:
``` R
```
Version: 1.0
RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: No
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment