|
|
|
@ -31,7 +31,7 @@ class NCFileW
|
|
|
|
|
{ |
|
|
|
|
struct |
|
|
|
|
{ |
|
|
|
|
int xdimid, ydimid; |
|
|
|
|
int ydimid, xdimid; |
|
|
|
|
}; |
|
|
|
|
int dimid[2]; |
|
|
|
|
}; |
|
|
|
@ -114,11 +114,11 @@ class NCFileW
|
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
const size_t i[2] = {0, 0}; |
|
|
|
|
const size_t c[2] = {data.Nx(), data.Ny()}; |
|
|
|
|
const size_t c[2] = {data.Ny(), data.Nx()}; |
|
|
|
|
float buf[c[0] * c[1]]; |
|
|
|
|
|
|
|
|
|
for(size_t ix = 0; ix < c[0]; ix++) |
|
|
|
|
for(size_t iy = 0; iy < c[1]; iy++) buf[ix * c[1] + iy] = data.IsFill(ix, iy) ? fill : op(ix, iy); |
|
|
|
|
for(size_t iy = 0; iy < c[0]; iy++) |
|
|
|
|
for(size_t ix = 0; ix < c[1]; ix++) buf[iy * c[1] + ix] = data.IsFill(ix, iy) ? fill : op(ix, iy); |
|
|
|
|
|
|
|
|
|
ret = nc_put_vara_float(ncid, vars[v].id, i, c, buf); |
|
|
|
|
if(ret != NC_NOERR) return "Can't write " + vars[v].name + " variable in the netcdf file"; |
|
|
|
@ -179,14 +179,14 @@ class NCFileW
|
|
|
|
|
else if constexpr(dtype == G2V2) |
|
|
|
|
{ |
|
|
|
|
const size_t i[2] = {0, 0}; |
|
|
|
|
const size_t c[2] = {data.Nx(), data.Ny()}; |
|
|
|
|
const size_t c[2] = {data.Ny(), data.Nx()}; |
|
|
|
|
float bufx[c[0] * c[1]]; |
|
|
|
|
float bufy[c[0] * c[1]]; |
|
|
|
|
for(size_t ix = 0; ix < c[0]; ix++) |
|
|
|
|
for(size_t iy = 0; iy < c[1]; iy++) |
|
|
|
|
for(size_t iy = 0; iy < c[0]; iy++) |
|
|
|
|
for(size_t ix = 0; ix < c[1]; ix++) |
|
|
|
|
{ |
|
|
|
|
bufx[ix * c[1] + iy] = data.Lon(ix, iy); |
|
|
|
|
bufy[ix * c[1] + iy] = data.Lat(ix, iy); |
|
|
|
|
bufx[iy * c[1] + ix] = data.Lon(ix, iy); |
|
|
|
|
bufy[iy * c[1] + ix] = data.Lat(ix, iy); |
|
|
|
|
} |
|
|
|
|
ret = nc_put_vara_float(ncid, xid, i, c, bufx); |
|
|
|
|
if(ret != NC_NOERR) return "Can't write longitude variable in the netcdf file"; |
|
|
|
|