NetCDF Analysis of Temperature & Precipitation Data + ModelBuilder

4912
16
06-07-2017 03:37 PM
ChrisMcCloud
New Contributor

I'm working on a project examining potential environmental changes in the Chesapeake Bay watershed and the resulting potential impacts on local jurisdictions and planning.  As part of this, I have a number of NetCDF files containing temperature and precipitation data projections across 93 years.  How do I, first, separate out certain years as raster files with attribute tables containing the temperature and precipitation data, and second, automate the process using ModelBuilder so that it is easier to duplicate the process across different jurisdictions and regions? I'm using ArcGIS Advanced 10.4.1.   netcdf data and model builder netcdf

0 Kudos
16 Replies
ChrisRingo
Occasional Contributor

I haven't used netCDF files in quite some time, but the tools to pull out the individual layers are in the "Multidimension Tools" toolbox; you'd want "Make NetCDF Raster Layer".  See the article http://desktop.arcgis.com/en/arcmap/10.4/manage-data/netcdf/reading-netcdf-data-as-a-raster-layer.ht....

My memory is that when you enter an input netCDF file, you'll see a drop-down list of variables contained in the netCDF file - you'll have to see exactly how the data are organized in your files.  Then it's easy to pull that tool into model builder (if you know how to use it, that is).  

ChrisMcCloud
New Contributor

Thanks for your reply.  I'm familiar with the "Make NetCDF Raster" Tool, but when I try and run it, even after defining the projection, ModelBuilder says that there is no spatial reference.  I tried both Define Projection and Project (although, by convention, the original NetCDF file should be in WGS 84).  And it's mostly after applying that tool that the process becomes a bit more murky for me, in the separating out the individual years and months of interest (namely, 4 specific years and 4 months of each year, one representing each season), and individual jurisdictions of interest.  We're looking at 4 particular years and 4 particular months of each year, but the NetCDF files contain data for each month of each year, not annual data.  So, in theory, I suppose one must generate an individual raster for each month of each year of interest, then use the Raster Calculator to combine said months into one raster representing the year as a whole.  The data also has to be clipped, considering the original raster generated is national in scope and we are looking more regional and local.  But I'm very uncertain about the procedure after applying the aforementioned tool.  The spatial reference error generally kicks in around where the Clip tool is applied (current flowpath for each month in question is Make NetCDF Raster (month of interest selected under Dimension Values)-->Define Projection (WGS 84)-->Project (MD State Plane NAD 83)-->Clip (Somerset County, MD, MD SP NAD83)-->Raster Calculator (combined with other months, divided by 12)-->Representative Annual Raster for Year.  There are preconditions in place to ensure the sequence for each month completes before the subsequent month runs and to ensure all monthly rasters generate before the Raster Calculator runs.)

I've also tried removing the Define Projection, as well as shuffling the flowpath order, flipping the order of the Clip and Project, shifting the clip features into WGS 84 first to run the Clip, then projecting the clipped jurisdiction into the State Plane system afterward.  It always results in the same error regarding the spatial reference.  

0 Kudos
ChrisMcCloud
New Contributor

Update: I also tried using the NetCDF Time Series Extract script as detailed at How To: Export each time slice from a NetCDF layer as a single raster (*.tif), but I still got a spatial reference error.  I checked the properties for the multidimensional raster generated by the Make NetCDF Raster tool as the preliminary step to using the script, and WGS 84 is set as the datum in the properties, so I'm still unsure where the error is coming from.  Could it have something to do with trying to run a transformation to NAD 83 as part of the script environment?  The precise error returned from the script was the following.  I believe the latter portion is the same as the error message received from ModelBuilder when I attempted the procedure described previously: 

ExecuteError: ERROR 999999: Error executing function.
The table name is invalid.
No spatial reference exists.
The table was not found. [NetCDF_Raster.tif]
Failed to execute (CopyRaster).

0 Kudos
ChrisRingo
Occasional Contributor

Are you able to run the Make NetCDF Raster Tool outside of Model Builder?  Might be time to attach a sample of your data and your code.  The error message seems to indicate a naming problem.

0 Kudos
ChrisMcCloud
New Contributor

Yes; the tool itself doesn't seem to throw the error. It's any processes run on the output generated by the tool that generate the error.

I will confess that I'm not entirely sure how to attach the code itself. I can attach one of the files I am using relatively easily shortly.

Sent from my iPhone

0 Kudos
ChrisRingo
Occasional Contributor

Have you tried saving the raster layer to an actual raster before running the other processes?

0 Kudos
ChrisMcCloud
New Contributor

I'll check that.  Unfortunately the NetCDF file I'm using is too large to attach by itself.

0 Kudos
ChrisMcCloud
New Contributor

I ran Copy Raster on the output of the Make NetCDF Raster tool, but the same error appeared - no spatial reference exists, the table was not found.  

0 Kudos
ChrisRingo
Occasional Contributor

To get further on this, I think we're going to have to see your exact job stream.  Did the same error appear when you ran the Copy Raster tool, or the next step in your job stream?  It's difficult to tell from your posts.

You said previously that the error you are getting was:

ExecuteError: ERROR 999999: Error executing function.
The table name is invalid.
No spatial reference exists.
The table was not found. [NetCDF_Raster.tif]
Failed to execute (CopyRaster).

I'm wondering about the "The table name is invalid" part - the problem may not have anything to do with the spatial reference.
0 Kudos