Skip to main content
edited title
Link
user30184
  • 69k
  • 4
  • 71
  • 125

How to preserve NetCDF dimensions with gdal.warp

edited title
Link

How to maintain grouppreserve dimensions with gdal warp.warp

added 86 characters in body
Source Link

I have a netcdf file that is structured with precipitation grid values with dimensions (time, x, y)

When I perform gdal.warp (in python if that matters) I get a new file that has multiple bands that have dimensions (x, y), with the number of bands = len(time) of the previous file and time is not part of the new file.

Is there a way to preserve the dimensions, precipitation name, and time in the new file?

import gdal

warped = gdal.Warp(
                destNameOrDestDS=destNameOrDestDS,
                srcDSOrSrcDSTab=srcDSOrSrcDSTab,
                srcSRS=srcSRS,
                dstSRS=dstSRS,
                dstNodata=float(srcNodata),
                format="NETCDF",
                xRes=xRes,
                yRes=yRes,
                targetAlignedPixels=targetAlignedPixels,
            )

So my source netcdf file looks like:

  • crs
  • QPE
  • time
  • x
  • y
  • z

where crs is the coordinate system and QPE is precipitation and then my output looks like:

  • Albers
  • Band1
  • Band2
  • Band3
  • x
  • y

I would like to preserve the original structure so combine the Bands into a single 3 dimensional array with time as the 3rd dimension.

I have a netcdf file that is structured with precipitation grid values with dimensions (time, x, y)

When I perform gdal.warp (in python if that matters) I get a new file that has multiple bands that have dimensions (x, y), with the number of bands = len(time) of the previous file and time is not part of the new file.

Is there a way to preserve the dimensions, precipitation name, and time in the new file?

import gdal

warped = gdal.Warp(
                destNameOrDestDS=destNameOrDestDS,
                srcDSOrSrcDSTab=srcDSOrSrcDSTab,
                srcSRS=srcSRS,
                dstSRS=dstSRS,
                dstNodata=float(srcNodata),
                format="NETCDF",
                xRes=xRes,
                yRes=yRes,
                targetAlignedPixels=targetAlignedPixels,
            )

So my source netcdf file looks like:

  • crs
  • QPE
  • time
  • x
  • y
  • z

where crs is the coordinate system and QPE is precipitation and then my output looks like:

  • Albers
  • Band1
  • Band2
  • Band3
  • x
  • y

I would like to preserve the original structure.

I have a netcdf file that is structured with precipitation grid values with dimensions (time, x, y)

When I perform gdal.warp (in python if that matters) I get a new file that has multiple bands that have dimensions (x, y), with the number of bands = len(time) of the previous file and time is not part of the new file.

Is there a way to preserve the dimensions, precipitation name, and time in the new file?

import gdal

warped = gdal.Warp(
                destNameOrDestDS=destNameOrDestDS,
                srcDSOrSrcDSTab=srcDSOrSrcDSTab,
                srcSRS=srcSRS,
                dstSRS=dstSRS,
                dstNodata=float(srcNodata),
                format="NETCDF",
                xRes=xRes,
                yRes=yRes,
                targetAlignedPixels=targetAlignedPixels,
            )

So my source netcdf file looks like:

  • crs
  • QPE
  • time
  • x
  • y
  • z

where crs is the coordinate system and QPE is precipitation and then my output looks like:

  • Albers
  • Band1
  • Band2
  • Band3
  • x
  • y

I would like to preserve the original structure so combine the Bands into a single 3 dimensional array with time as the 3rd dimension.

Source Link
Loading