I have been working with NetCDF files from Daymet and my project involves extracting data from various files, modifying them and creating new files in R which will then be analyzed in Arcmaps. Using the make NetCDF raster layer tool with with x and y as the dimensions works fine with unmodified data from day met but does nothing to the files I made myself. Using coordinate variables works for both of them but the product comes out distorted. Looking at the differences between the files I created the only difference is that the ones I created don't have any spatial reference coordinates.
There is an existing spatial reference or projection in the unmodified file, which looks like in the metadata:
' 5 variables (excluding dimension variables):
float time_bnds[nv,time]
time: days since 1980-01-01 00:00:00 UTC' short lambert_conformal_conic[]
grid_mapping_name: lambert_conformal_conic
longitude_of_central_meridian: -100
latitude_of_projection_origin: 42.5
false_easting: 0
false_northing: 0
standard_parallel: 25
standard_parallel: 60
semi_major_axis: 6378137
inverse_flattening: 298.257232666016
With the netcdf r package was able to create something similar looking this code:
' corddef <- ncvar_def("lambert_conformal_conic","", list(), prec="short") ncatt_put(ncout, "lambert_conformal_conic", "grid_mapping_name", "lambert_conformal_conic") ncatt_put(ncout,"lambert_conformal_conic","longitude_of_central_meridian", "-100") ncatt_put(ncout,"lambert_conformal_conic","latitude_of_projection_origin", "42.5") ncatt_put(ncout,"lambert_conformal_conic","false_easting", "0") ncatt_put(ncout,"lambert_conformal_conic","false_northing", "0") ncatt_put(ncout,"lambert_conformal_conic","standard_parallel", "25") ncatt_put(ncout,"lambert_conformal_conic","standard_parallel_2", "60") ncatt_put(ncout,"lambert_conformal_conic","semi_major_axis", "6378137") ncatt_put(ncout,"lambert_conformal_conic","inverse_flattening", "298.257232666016")
Which gives this:
' 5 variables (excluding dimension variables):
float time_bnds[time] (Chunking: [1])
units: days since 1980-01-01 00:00:00 UTC
short lambert_conformal_conic[] (Contiguous storage)
grid_mapping_name: lambert_conformal_conic
longitude_of_central_meridian: -100
latitude_of_projection_origin: 42.5
false_easting: 0
false_northing: 0
standard_parallel: 25
standard_parallel_2: 60
semi_major_axis: 6378137
inverse_flattening: 298.257232666016
Trying to make a raster out of it in Arcmaps still doesn't do anything though so I was wondering if there was a better way to put the information about the projection directly into the new file I'm creating so that arcmaps can automatically read the information.