Refactoring: cryptic variable names

This commit is contained in:
Shahram Najm 2020-03-14 13:07:01 +00:00
parent 816f5419f4
commit 003b3809bf
9 changed files with 42 additions and 42 deletions

View File

@ -41,7 +41,7 @@
MEMBERS=const char* width_lengths MEMBERS=const char* width_lengths
MEMBERS=const char* octet_start_group MEMBERS=const char* octet_start_group
MEMBERS=const char* width_spd_sp_desc MEMBERS=const char* width_spd_sp_desc
MEMBERS=const char* nap MEMBERS=const char* Ni
MEMBERS=const char* bitmap MEMBERS=const char* bitmap
END_CLASS_DEF END_CLASS_DEF
@ -96,7 +96,7 @@ typedef struct grib_accessor_data_2order_packing
const char* width_lengths; const char* width_lengths;
const char* octet_start_group; const char* octet_start_group;
const char* width_spd_sp_desc; const char* width_spd_sp_desc;
const char* nap; const char* Ni;
const char* bitmap; const char* bitmap;
} grib_accessor_data_2order_packing; } grib_accessor_data_2order_packing;
@ -218,7 +218,7 @@ static void init(grib_accessor* a, const long v, grib_arguments* args)
self->width_lengths = grib_arguments_get_name(gh, args, self->carg++); self->width_lengths = grib_arguments_get_name(gh, args, self->carg++);
self->octet_start_group = grib_arguments_get_name(gh, args, self->carg++); self->octet_start_group = grib_arguments_get_name(gh, args, self->carg++);
self->width_spd_sp_desc = grib_arguments_get_name(gh, args, self->carg++); self->width_spd_sp_desc = grib_arguments_get_name(gh, args, self->carg++);
self->nap = grib_arguments_get_name(gh, args, self->carg++); self->Ni = grib_arguments_get_name(gh, args, self->carg++);
self->bitmap = grib_arguments_get_name(gh, args, self->carg++); self->bitmap = grib_arguments_get_name(gh, args, self->carg++);
a->flags |= GRIB_ACCESSOR_FLAG_DATA; a->flags |= GRIB_ACCESSOR_FLAG_DATA;
} }
@ -466,7 +466,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
long pointer_of_group_size = 0; long pointer_of_group_size = 0;
long pointer_of_group_width = 0; long pointer_of_group_width = 0;
long refsp = 0; long refsp = 0;
long nap = 0; long Ni = 0;
long nn = 0; long nn = 0;
unsigned char* bitmap = NULL; unsigned char* bitmap = NULL;
grib_accessor* abitmap = NULL; grib_accessor* abitmap = NULL;
@ -523,7 +523,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
if ((err = grib_get_long_internal(gh, self->width_spd_sp_desc, &width_spd_sp_desc)) != GRIB_SUCCESS) if ((err = grib_get_long_internal(gh, self->width_spd_sp_desc, &width_spd_sp_desc)) != GRIB_SUCCESS)
width_spd_sp_desc = -1; width_spd_sp_desc = -1;
if ((err = grib_get_long_internal(gh, self->nap, &nap)) != GRIB_SUCCESS) if ((err = grib_get_long_internal(gh, self->Ni, &Ni)) != GRIB_SUCCESS)
return err; return err;
self->dirty = 0; self->dirty = 0;
@ -642,7 +642,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
de_spatial_difference(a->context, sec_val, n_vals, n_sp_diff, bias); de_spatial_difference(a->context, sec_val, n_vals, n_sp_diff, bias);
if (boustrophedonic) if (boustrophedonic)
reverse_rows(sec_val, n_vals, nap, bitmap, bitmap_len); reverse_rows(sec_val, n_vals, Ni, bitmap, bitmap_len);
s = grib_power(binary_scale_factor, 2); s = grib_power(binary_scale_factor, 2);
d = grib_power(-decimal_scale_factor, 10); d = grib_power(-decimal_scale_factor, 10);
@ -731,7 +731,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
long pointer_of_group_size = 0; long pointer_of_group_size = 0;
long pointer_of_group_width = 0; long pointer_of_group_width = 0;
long refsp = 0; long refsp = 0;
long nap = 0; long Ni = 0;
long offsetdata = 0; long offsetdata = 0;
double max; double max;
@ -763,7 +763,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
return err; return err;
if ((err = grib_get_long_internal(gh, self->width_spd_sp_desc, &width_spd_sp_desc)) != GRIB_SUCCESS) if ((err = grib_get_long_internal(gh, self->width_spd_sp_desc, &width_spd_sp_desc)) != GRIB_SUCCESS)
return err; return err;
if ((err = grib_get_long_internal(gh, self->nap, &nap)) != GRIB_SUCCESS) if ((err = grib_get_long_internal(gh, self->Ni, &Ni)) != GRIB_SUCCESS)
return err; return err;
if ((abitmap = grib_find_accessor(gh, self->bitmap)) != NULL) { if ((abitmap = grib_find_accessor(gh, self->bitmap)) != NULL) {
@ -816,7 +816,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
/* reverse the rows*/ /* reverse the rows*/
if (boustrophedonic) if (boustrophedonic)
reverse_rows(sec_val, n_vals, nap, bitmap, bitmap_len); reverse_rows(sec_val, n_vals, Ni, bitmap, bitmap_len);
if (snd_ordr_wdiff) if (snd_ordr_wdiff)

View File

@ -51,8 +51,8 @@ typedef struct grib_iterator_gaussian
/* Members defined in regular */ /* Members defined in regular */
double* las; double* las;
double* los; double* los;
long nap; long Ni;
long nam; long Nj;
long iScansNegatively; long iScansNegatively;
long isRotated; long isRotated;
double angleOfRotation; double angleOfRotation;
@ -146,13 +146,13 @@ static int init(grib_iterator* i, grib_handle* h, grib_arguments* args)
Assert(istart < size); Assert(istart < size);
if (jScansPositively) { if (jScansPositively) {
for (lai = 0; lai < self->nam; lai++) { for (lai = 0; lai < self->Nj; lai++) {
self->las[lai] = lats[istart--]; self->las[lai] = lats[istart--];
/*if (istart<0) istart=size-1; this condition is always FALSE -- 'istart' is unsigned long */ /*if (istart<0) istart=size-1; this condition is always FALSE -- 'istart' is unsigned long */
} }
} }
else { else {
for (lai = 0; lai < self->nam; lai++) { for (lai = 0; lai < self->Nj; lai++) {
self->las[lai] = lats[istart++]; self->las[lai] = lats[istart++];
if (istart > size - 1) if (istart > size - 1)
istart = 0; istart = 0;

View File

@ -26,7 +26,7 @@
IMPLEMENTS = init;next IMPLEMENTS = init;next
MEMBERS = double *las MEMBERS = double *las
MEMBERS = double *los MEMBERS = double *los
MEMBERS = long nam MEMBERS = long Nj
END_CLASS_DEF END_CLASS_DEF
*/ */
@ -58,7 +58,7 @@ typedef struct grib_iterator_gaussian_reduced
/* Members defined in gaussian_reduced */ /* Members defined in gaussian_reduced */
double* las; double* las;
double* los; double* los;
long nam; long Nj;
} grib_iterator_gaussian_reduced; } grib_iterator_gaussian_reduced;
extern grib_iterator_class* grib_iterator_class_gen; extern grib_iterator_class* grib_iterator_class_gen;

View File

@ -26,7 +26,7 @@
IMPLEMENTS = init;next IMPLEMENTS = init;next
MEMBERS = double *lats MEMBERS = double *lats
MEMBERS = double *lons MEMBERS = double *lons
MEMBERS = long nam MEMBERS = long Nj
END_CLASS_DEF END_CLASS_DEF
*/ */
@ -57,7 +57,7 @@ typedef struct grib_iterator_lambert_azimuthal_equal_area
/* Members defined in lambert_azimuthal_equal_area */ /* Members defined in lambert_azimuthal_equal_area */
double* lats; double* lats;
double* lons; double* lons;
long nam; long Nj;
} grib_iterator_lambert_azimuthal_equal_area; } grib_iterator_lambert_azimuthal_equal_area;
extern grib_iterator_class* grib_iterator_class_gen; extern grib_iterator_class* grib_iterator_class_gen;

View File

@ -21,7 +21,7 @@
IMPLEMENTS = init;next IMPLEMENTS = init;next
MEMBERS = double *lats MEMBERS = double *lats
MEMBERS = double *lons MEMBERS = double *lons
MEMBERS = long nam MEMBERS = long Nj
END_CLASS_DEF END_CLASS_DEF
*/ */
@ -52,7 +52,7 @@ typedef struct grib_iterator_lambert_conformal
/* Members defined in lambert_conformal */ /* Members defined in lambert_conformal */
double* lats; double* lats;
double* lons; double* lons;
long nam; long Nj;
} grib_iterator_lambert_conformal; } grib_iterator_lambert_conformal;
extern grib_iterator_class* grib_iterator_class_gen; extern grib_iterator_class* grib_iterator_class_gen;

View File

@ -47,8 +47,8 @@ typedef struct grib_iterator_latlon
/* Members defined in regular */ /* Members defined in regular */
double* las; double* las;
double* los; double* los;
long nap; long Ni;
long nam; long Nj;
long iScansNegatively; long iScansNegatively;
long isRotated; long isRotated;
double angleOfRotation; double angleOfRotation;
@ -102,14 +102,14 @@ static int next(grib_iterator* iter, double* lat, double* lon, double* val)
*/ */
if (!self->jPointsAreConsecutive) { if (!self->jPointsAreConsecutive) {
/* Adjacent points in i (x) direction are consecutive */ /* Adjacent points in i (x) direction are consecutive */
ret_lat = self->las[(long)floor(iter->e / self->nap)]; ret_lat = self->las[(long)floor(iter->e / self->Ni)];
ret_lon = self->los[(long)iter->e % self->nap]; ret_lon = self->los[(long)iter->e % self->Ni];
ret_val = iter->data[iter->e]; ret_val = iter->data[iter->e];
} }
else { else {
/* Adjacent points in j (y) direction is consecutive */ /* Adjacent points in j (y) direction is consecutive */
ret_lon = self->los[(long)iter->e / self->nam]; ret_lon = self->los[(long)iter->e / self->Nj];
ret_lat = self->las[(long)floor(iter->e % self->nam)]; ret_lat = self->las[(long)floor(iter->e % self->Nj)];
ret_val = iter->data[iter->e]; ret_val = iter->data[iter->e];
} }
@ -175,7 +175,7 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
if (grib_is_missing(h, s_jdir, &err) && err == GRIB_SUCCESS) { if (grib_is_missing(h, s_jdir, &err) && err == GRIB_SUCCESS) {
double lat2; double lat2;
if ((err = grib_get_double_internal(h, "latitudeLastInDegrees", &lat2)) == GRIB_SUCCESS) { if ((err = grib_get_double_internal(h, "latitudeLastInDegrees", &lat2)) == GRIB_SUCCESS) {
const long Nj = self->nam; const long Nj = self->Nj;
Assert(Nj > 1); Assert(Nj > 1);
if (lat1 > lat2) { if (lat1 > lat2) {
jdir = (lat1 - lat2) / (Nj - 1); jdir = (lat1 - lat2) / (Nj - 1);
@ -190,7 +190,7 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
if (jScansPositively) if (jScansPositively)
jdir = -jdir; jdir = -jdir;
for (lai = 0; lai < self->nam; lai++) { for (lai = 0; lai < self->Nj; lai++) {
self->las[lai] = lat1; self->las[lai] = lat1;
lat1 -= jdir; lat1 -= jdir;
} }

View File

@ -21,7 +21,7 @@
IMPLEMENTS = init;next IMPLEMENTS = init;next
MEMBERS = double *lats MEMBERS = double *lats
MEMBERS = double *lons MEMBERS = double *lons
MEMBERS = long nam MEMBERS = long Nj
END_CLASS_DEF END_CLASS_DEF
*/ */
@ -52,7 +52,7 @@ typedef struct grib_iterator_polar_stereographic
/* Members defined in polar_stereographic */ /* Members defined in polar_stereographic */
double* lats; double* lats;
double* lons; double* lons;
long nam; long Nj;
} grib_iterator_polar_stereographic; } grib_iterator_polar_stereographic;
extern grib_iterator_class* grib_iterator_class_gen; extern grib_iterator_class* grib_iterator_class_gen;

View File

@ -21,8 +21,8 @@
IMPLEMENTS = init;destroy IMPLEMENTS = init;destroy
MEMBERS = double *las MEMBERS = double *las
MEMBERS = double *los MEMBERS = double *los
MEMBERS = long nap MEMBERS = long Ni
MEMBERS = long nam MEMBERS = long Nj
MEMBERS = long iScansNegatively MEMBERS = long iScansNegatively
MEMBERS = long isRotated MEMBERS = long isRotated
MEMBERS = double angleOfRotation MEMBERS = double angleOfRotation
@ -62,8 +62,8 @@ typedef struct grib_iterator_regular
/* Members defined in regular */ /* Members defined in regular */
double* las; double* las;
double* los; double* los;
long nap; long Ni;
long nam; long Nj;
long iScansNegatively; long iScansNegatively;
long isRotated; long isRotated;
double angleOfRotation; double angleOfRotation;
@ -109,8 +109,8 @@ static int next(grib_iterator* i, double* lat, double* lon, double* val)
i->e++; i->e++;
*lat = self->las[(long)floor(i->e / self->nap)]; *lat = self->las[(long)floor(i->e / self->Ni)];
*lon = self->los[(long)i->e % self->nap]; *lon = self->los[(long)i->e % self->Ni];
*val = i->data[i->e]; *val = i->data[i->e];
return 1; return 1;
@ -122,8 +122,8 @@ static int previous(grib_iterator* i, double* lat, double* lon, double* val)
if (i->e < 0) if (i->e < 0)
return 0; return 0;
*lat = self->las[(long)floor(i->e / self->nap)]; *lat = self->las[(long)floor(i->e / self->Ni)];
*lon = self->los[i->e % self->nap]; *lon = self->los[i->e % self->Ni];
*val = i->data[i->e]; *val = i->data[i->e];
i->e--; i->e--;
@ -168,7 +168,7 @@ static int init(grib_iterator* i, grib_handle* h, grib_arguments* args)
if ((ret = grib_get_long_internal(h, s_iScansNeg, &self->iScansNegatively))) if ((ret = grib_get_long_internal(h, s_iScansNeg, &self->iScansNegatively)))
return ret; return ret;
/* GRIB-801: Careful of case with a single point! nap==1 */ /* GRIB-801: Careful of case with a single point! Ni==1 */
if (Ni > 1) { if (Ni > 1) {
/* Note: If first and last longitudes are equal I assume you wanna go round the globe */ /* Note: If first and last longitudes are equal I assume you wanna go round the globe */
if (self->iScansNegatively) { if (self->iScansNegatively) {
@ -200,8 +200,8 @@ static int init(grib_iterator* i, grib_handle* h, grib_arguments* args)
}*/ }*/
} }
self->nap = Ni; self->Ni = Ni;
self->nam = Nj; self->Nj = Nj;
self->las = (double*)grib_context_malloc(h->context, Nj * sizeof(double)); self->las = (double*)grib_context_malloc(h->context, Nj * sizeof(double));
self->los = (double*)grib_context_malloc(h->context, Ni * sizeof(double)); self->los = (double*)grib_context_malloc(h->context, Ni * sizeof(double));

View File

@ -21,7 +21,7 @@
IMPLEMENTS = init;next IMPLEMENTS = init;next
MEMBERS = double *lats MEMBERS = double *lats
MEMBERS = double *lons MEMBERS = double *lons
MEMBERS = long nam MEMBERS = long Nj
END_CLASS_DEF END_CLASS_DEF
*/ */
@ -52,7 +52,7 @@ typedef struct grib_iterator_space_view
/* Members defined in space_view */ /* Members defined in space_view */
double* lats; double* lats;
double* lons; double* lons;
long nam; long Nj;
} grib_iterator_space_view; } grib_iterator_space_view;
extern grib_iterator_class* grib_iterator_class_gen; extern grib_iterator_class* grib_iterator_class_gen;