Skip to content

Commit

Permalink
properly update install.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gareth-d-ga committed Feb 2, 2023
1 parent 6c4c180 commit ff1d00d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 36 deletions.
56 changes: 20 additions & 36 deletions ptha_access/INSTALL.Rmd
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions ptha_access/INSTALL.md
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ff1d00d

Please sign in to comment.