Skip to main content

7. the slow nc to geotiff thing

  • number: 7
  • opened: 2019-05-15
  • state when archived: open
  • url when archived: https://github.com/rgdal-dev/rasterwise/issues/7
  • archived: 2026-11-06 (authors omitted; email addresses and reply headers redacted; non-ASCII transliterated)

Opening post

Seems to be purely down to dimension order.

u <- "https://s3-ap-southeast-2.amazonaws.com/silo-open-data/annual/daily_rain/1889.daily_rain.nc"
curl::curl_download(u, file.path(basename(u)))


## 40 minutes?
system.time({
system("gdal_translate 1889.daily_rain.nc out.tif  -co TILED=YES -co COMPRESS=LZW -co INTERLEAVE=BAND -unscale -ot Float32 -a_srs EPSG:4283")
})


## About a minute
system.time({
system("ncpdq -a lon,lat,time 1889.daily_rain.nc llt.nc") 
system("ncks --fix_rec_dmn lon llt.nc -o outfixed.nc ; mv outfixed.nc llt.nc")
})

## about a minute
system.time({
  
system("gdal_translate llt.nc out.tif -co NUM_THREADS=ALL_CPUS -co TILED=YES -co COMPRESS=LZW -co INTERLEAVE=BAND -unscale -ot Float32 -a_srs EPSG:4283")
})