Skip to content

Instantly share code, notes, and snippets.

@spestana
Created October 15, 2018 00:27
Show Gist options
  • Save spestana/876fcd2ca1fbac441f28243bdc406c22 to your computer and use it in GitHub Desktop.
Save spestana/876fcd2ca1fbac441f28243bdc406c22 to your computer and use it in GitHub Desktop.
Quick convert NetCDF (GOES imagery) to png images files using gdal
@echo off
setlocal
set NCdir=%1
for /R %NCdir% %%f in (*.nc) do (
gdal_translate -ot float32 -unscale -CO COMPRESS=deflate NETCDF:"%%f":Rad "%NCdir%%%~nf.tif"
gdal_translate -ot Byte -of png -scale 0 650 0 255 "%NCdir%%%~nf.tif" "%NCdir%%%~nf.png"
gdalwarp -t_srs EPSG:4326 -dstnodata -999.0 "%NCdir%%%~nf.tif" "%NCdir%%%~nf_geo.tif"
gdal_translate -ot Byte -of png -scale 0 650 0 255 "%NCdir%%%~nf_geo.tif" "%NCdir%%%~nf_geo.png"
)
endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment