From 14c39172beb631e04bab6fe5361a91c79bc7dfc4 Mon Sep 17 00:00:00 2001 From: hsoh-u Date: Tue, 8 Dec 2020 15:16:53 -0700 Subject: [PATCH] #1421 read all 2D data at once --- met/src/libcode/vx_data2d_nccf/nccf_file.cc | 128 ++++++++++++-------- 1 file changed, 75 insertions(+), 53 deletions(-) diff --git a/met/src/libcode/vx_data2d_nccf/nccf_file.cc b/met/src/libcode/vx_data2d_nccf/nccf_file.cc index aa92536def..1bda6bca62 100644 --- a/met/src/libcode/vx_data2d_nccf/nccf_file.cc +++ b/met/src/libcode/vx_data2d_nccf/nccf_file.cc @@ -993,10 +993,11 @@ bool NcCfFile::getData(NcVar * v, const LongArray & a, DataPlane & plane) const } // get the data - int i[nx]; - short s[nx]; - float f[nx]; - double d[nx]; + int *i; + short *s; + double *d; + const int plane_size = nx * ny; + float *f = new float[plane_size]; size_t dim_size; long offsets[dim_count]; @@ -1016,6 +1017,9 @@ bool NcCfFile::getData(NcVar * v, const LongArray & a, DataPlane & plane) const offsets[x_slot] = 0; lengths[x_slot] = nx; + offsets[y_slot] = 0; + lengths[y_slot] = ny; + float add_offset = 0.f; float scale_factor = 1.f; NcVarAtt *att_add_offset = get_nc_att(v, (string)"add_offset"); @@ -1028,65 +1032,83 @@ bool NcCfFile::getData(NcVar * v, const LongArray & a, DataPlane & plane) const if (att_scale_factor) delete att_scale_factor; int type_id = GET_NC_TYPE_ID_P(v); - for (int y=0; y y_slot ) { + for (int y=0; y