From ff1d00dde00bea17daa54493373e2dd1a3832996 Mon Sep 17 00:00:00 2001 From: gareth-d-ga Date: Thu, 2 Feb 2023 16:37:25 +1100 Subject: [PATCH] properly update install.md --- ptha_access/INSTALL.Rmd | 56 +++++++++++++++-------------------------- ptha_access/INSTALL.md | 3 +++ 2 files changed, 23 insertions(+), 36 deletions(-) diff --git a/ptha_access/INSTALL.Rmd b/ptha_access/INSTALL.Rmd index f4df80a30..12310bb79 100644 --- a/ptha_access/INSTALL.Rmd +++ b/ptha_access/INSTALL.Rmd @@ -11,47 +11,29 @@ If you don't already have R installed, the you need to get it by following the instructions on the [R website](https://www.r-project.org/). Use the most recent version. -### **Getting a recent version of netcdf** +### **Installing netcdf** You need to install the R package `ncdf4` with OPeNDAP support. This may be difficult unless you are running Linux (although you can do this using a virtual machine). Non-Linux users are encouraged to install an Ubuntu virtual machine (e.g. using [VirtualBox](https://www.virtualbox.org) or some other -virtualization software) and follow the steps below. If you must run Windows, -we have heard of people successfully running the PTHA codes by using [this -package]{https://github.com/pmjherman/r-ncdf4-build-opendap-windows} instead of -the `ncdf4` package - although the author has not tried this. - -A further complication is that to work with the PTHA outputs on the NCI THREDDS -server you need to be using a recent version of netcdf-c. *NOTE: As of Ubuntu -18.04, you can use the 'standard' netcdf install obtained with apt-get.* -There was a bug in netcdf-c versions prior to 4.6.0 (released in early 2018) that -prevented the remote reading of long character strings with OPeNDAP. We store -some earthquake event data as (potentially) long character strings, and it is -essential to be able to read these remotely. - -If you are using an older version of netcdf then you will have to install -netcdf-c from source. Source-code for a recent release of -netcdf-c can be obtained from the [netcdf-c github -page](https://github.com/Unidata/netcdf-c/releases). You need to follow their -instructions to get it installed. - -Next you need to install R's `ncdf4` package, and specifically tell it to use -the newly installed netcdf. This can be done by -[downloading the ncdf4 sources from this site](https://cran.r-project.org/web/packages/ncdf4/index.html), -and then running a command similar to the following, in the directory where you -have downloaded the `ncdf4` source package: - - R CMD INSTALL ncdf4_1.16.tar.gz --configure-args="--with-nc-config=/home/username/PATH_TO_YOUR_NETCDF_INSTALL/bin/nc-config" - -On Ubuntu you might need to prepend `sudo` to the above command, depending on -where you do the installation. Also, you may need to adjust the numbers in the -`ncdf4_1.16.tar.gz` term above to match those of the package you download. -Furthermore, you definitely need to change the path to nc-config to match the -one on your machine. - -To confirm that your `ncdf4` installation is using a suitably recent netcdf-c -library, please run the following code: +virtualization software). + +On recent versions of Ubuntu (18.04 and greater) you can probably install netcdf libraries like this +``` +sudo apt-get install netcdf-bin libnetcdf-dev libnetcdff-dev +``` +and then install netcdf4 from inside R. +```r +# Run this from inside R. +# You may need to start R with "sudo R" to get permissions to install +install.packages('ncdf4') +``` + +An earlier version of Ubuntu shipped netcdf with an opendap bug, which caused +problems with ptha data access. To confirm that your `ncdf4` installation is +using a suitably recent netcdf-c library, please run the following code: + ```{r checkncdf, eval=FALSE} library(ncdf4) @@ -89,6 +71,7 @@ etc). If your internet is not working perfectly, or the NCI server is down, you will see an message like this: + ```{r errorMess, eval=FALSE} # Error in Rsx_nc4_get_vara_double: NetCDF: DAP failure # Var: gaugeID Ndims: 1 Start: 0 Count: 20185 @@ -100,6 +83,7 @@ then check if your internet is working. Also check whether the NCI THREDDS server is running (occasionally it goes down for maintainence or technical problems). + ### **Installing rptha** Finally you need to install the `rptha` package. This must be built from diff --git a/ptha_access/INSTALL.md b/ptha_access/INSTALL.md index 4e563e2bb..7b005fcec 100644 --- a/ptha_access/INSTALL.md +++ b/ptha_access/INSTALL.md @@ -34,6 +34,7 @@ An earlier version of Ubuntu shipped netcdf with an opendap bug, which caused problems with ptha data access. To confirm that your `ncdf4` installation is using a suitably recent netcdf-c library, please run the following code: + ```r library(ncdf4) @@ -72,6 +73,7 @@ etc). If your internet is not working perfectly, or the NCI server is down, you will see an message like this: + ```r # Error in Rsx_nc4_get_vara_double: NetCDF: DAP failure # Var: gaugeID Ndims: 1 Start: 0 Count: 20185 @@ -83,6 +85,7 @@ then check if your internet is working. Also check whether the NCI THREDDS server is running (occasionally it goes down for maintainence or technical problems). + ### **Installing rptha** Finally you need to install the `rptha` package. This must be built from