diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 81feca1c..be273338 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -12,11 +12,11 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - name: Install spatial dependencies run: brew install gdal @@ -29,7 +29,7 @@ jobs: shell: Rscript {0} - name: Restore R package cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ env.R_LIBS_USER }} key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} diff --git a/R/netCDFwriteCD.R b/R/netCDFwriteCD.R index ecfff799..b35d5d9f 100644 --- a/R/netCDFwriteCD.R +++ b/R/netCDFwriteCD.R @@ -160,12 +160,18 @@ } -.stopWriteCDF <- function(x) { +.writeRangeCDF <- function(x) { + nc <- ncdf4::nc_open(x@file@name, write=TRUE) on.exit( ncdf4::nc_close(nc) ) ncdf4::ncatt_put(nc, x@title, 'min', as.numeric(x@data@min)) ncdf4::ncatt_put(nc, x@title, 'max', as.numeric(x@data@max)) +} + + +.stopWriteCDF <- function(x) { + .writeRangeCDF(x) if (inherits(x, 'RasterBrick')) { r <- brick(x@file@name) } else {