AnsweredAssumed Answered

covert bulk NetCDF files to rasters

Question asked by giaMSU_1 on Sep 30, 2019

Dear community, 

Could you please to instruct me to write an ArcPy or Python code to convert multiple NetCDF files to rasters? 

I failed to use Iterator/ModelBuilder. 

I found a code to convert 1 NetCDF to a raster using MakeNetCDFRasterLayer function. However, I don't know how to write a loop to read through all NetCDF files.

I attached here 3 NetCDF files as an example for my dataset. 

All comments are appreciated.

Thank you so much.

 

# Import system modules

import arcpy

# Set local variables

inNetCDFFile = "C:/data/netcdf/rainfall.nc"

variable = "pptx"

XDimension = "lon"

YDimension = "lat"

outRasterLayer = "rainfall"

bandDimmension = ""

dimensionValues = ""

valueSelectionMethod = ""

cellRegistration = ""

 

# Execute MakeNetCDFRasterLayer

arcpy.MakeNetCDFRasterLayer_md(inNetCDFFile, variable, XDimension, YDimension,

                               outRasterLayer, bandDimmension, dimensionValues,

                               valueSelectionMethod, cellRegistration)

Attachments

Outcomes