Skip to content
Snippets Groups Projects
Commit 1d467b5f authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

Spread test code cell centers more evenly.

* Especially create the latitudes symmetrically from pole to pole.
parent 52452624
No related branches found
No related tags found
No related merge requests found
......@@ -133,13 +133,15 @@ createGlobalLatLonGrid(int nlon, int nlat)
size_t maxAxisSize = (size_t)(nlon > nlat ? nlon : nlat);
double *restrict coords = (double *)Malloc(maxAxisSize * sizeof (coords[0]));
{
double step = 360.0/(double)nlon, ofs = step*0.5;
for (size_t i = 0; i < (size_t)nlon; ++i)
coords[i] = ((double)(i * 360))/nlon;
coords[i] = (double)i * step + ofs;
gridDefXvals(gridID, coords);
}
{
double step = 180.0/(double)nlat, ofs = step*0.5;
for (size_t i = 0; i < (size_t)nlat; ++i)
coords[i] = ((double)(i * 180))/nlat - 90.0;
coords[i] = (double)i * step - 90.0 + ofs;
gridDefYvals(gridID, coords);
}
Free(coords);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment