I want to convert a netCDF4 dataset (including grouped datasets) to Arc/Info ASCII Grids, using Python's
gdal package. I tried to orientate at this question, the only thing I added is a loop over the subdatasets. Now, however, something went wrong and the script doesn't produce any output.
Can anyone help? Here's my code:
#Open existing dataset src_ds_list = glob("..\\*.nc") for path in src_ds_list: src_ds = gdal.Open(path) subdata = src_ds.GetSubDatasets() for s in range(len(subdata)): sds = gdal.Open(subdata[s]) dst_path = '..\\' + subdata[s] + 'arbitrary' + '.asc' # Open output format driver, see gdal_translate --formats for list oformat = "AAIGrid" driver = gdal.GetDriverByName(oformat) # Output to new format dst_ds = driver.CreateCopy(dst_path, sds, 0) dst_ds = None sds= None src_ds = None