using arcpy to export separate netcdf dimension values as a raster

Discussion created by slburns on Jun 9, 2011
Latest reply on May 25, 2016 by umair092
Hi All,
I would like to open a netcdf file which has a months worth of data and then export each day as a separate raster. I can run arcpy to get a particular day if I enter the name of the day in the dimension field (i.e 2/02/1999) but how can I get it to find them without me having to enter each one and then export each one.
I have made an attempt at the code using acrpy.MakeNetCDFRasterLayer_md and arcpy.CopyRaster_managment but I don't understand how to work loop through the dimension values and how to work with files that go to memory (which is what happens to the netcdf files).
Any feedback will be greatly appreciated.
See code below

#Make a separate raster *.img file for each dimension value (time) in a netcdf file
import arcpy
from arcpy import env
from import *

# Set local variables
inNetCDFFile = "D:/data/netcdffiles/"
variable = "TEMPERATURE"
XDimension = "longitude"
YDimension = "latitude"
bandDimmension = ""
dimensionValues = "time"
valueSelectionMethod = ""
InMemory_netcdf_raster = "InMemory_netCDF_File"
outRasterFolder = "D:/data/netcdffiles/OutputRasters/"

for DimensionValuesofTime in arcpy.ListDimensionValues():
    # Execute MakeNetCDFRasterLayer
    arcpy.MakeNetCDFRasterLayer_md(inNetCDFFile, variable, XDimension, YDimension,
                               InMemory_netCDF_File, bandDimension, dimensionValues,

for Rasters in arcpy.ListRasters():
    #export raster layer (from scratch workspace?) to raster output folder as *.img
    arcpy.CopyRaster_management(InMemory_netCDF_File, OutputRasterFolder, "", "", "NONE", "NONE", "")