How to reverse the latitudes while saving a variable in an nc file

4 views (last 30 days)
I am trying to save the variable curl into an nc file. But when the file is saved it is reversed on the latitudinal dimension. Meaning, the variable curl is saved as a mirror image of itself (mirrored on the equatorial plane). This is the code that I have used to save the variable. Please help me understand where I am going wrong.
nccreate('curl_mat.nc', 'longitude','Dimensions',{'longitude' length(lonx)});
nccreate('curl_mat.nc', 'latitude','Dimensions',{'latitude' length(latx)});
nccreate('curl_mat.nc', 'time','Dimensions',{'time' length(tnew)});
nccreate('curl_mat.nc', 'curl', 'Dimensions',{'longitude' length(lonx) 'latitude' length(latx) 'time' length(tnew)});
ncwrite('curl_mat.nc', 'time', tnew);
ncwriteatt( 'curl_mat.nc', 'time', 'units', ...
'days since 1950-01-01 00:00:00' );
ncwrite('curl_mat.nc', 'longitude', lonx);
ncwriteatt( 'curl_mat.nc', 'longitude', 'units', 'degrees east');
ncwrite('curl_mat.nc', 'latitude', latx);
ncwriteatt( 'curl_mat.nc', 'latitude', 'units', 'degrees north');
ncwrite('curl_mat.nc', 'curl', curl);
ncwriteatt('curl_mat.nc', 'curl' , 'units', 'N/m3');

Answers (0)

Categories

Find more on Geology in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!