I am using code similar to this - Read in coordinate variables to read in latitude and longitude from a netCDF file
call check( nf_inq_varid(ncid, LAT_NAME, lat_varid) )
call check( nf_inq_varid(ncid, LON_NAME, lon_varid) )
! Read the latitude and longitude data.
call check( nf_get_var(ncid, lat_varid, lats) )
call check( nf_get_var(ncid, lon_varid, lons) )
Both lats and lons are 1-Dimensional fortran arrays.
My initial data set is in geographical coordinates and I need to convert this into a rotated lat lon grid and I use the code in this URL Geographical to rotated lat lon grid.
The way this works is the following For each geographical latitude and longitude I get a rotated latitude. Ditto for rotated longitude.
Mathematically
f(latitude_geo,longitude_geo) = latitude_rot
f(latitude_geo,longitude_geo) = longitude_rot
So the rotated lat and lon arrays are two dimensional arrays. I want to be able to write the rotated lat and lon arrays back to the original netCDF file using nf_put_vara_real or nf_90_put_vara_real(f77 or f90 does not matter).
How can I do this since the original lat and lon arrays are 1-D arrays ? Is it possible to read the original 1-d arrays as 2-D arrays ?