This commit is contained in:
Shahram Najm 2016-04-07 16:14:41 +01:00
parent 3a17c2bc56
commit ccf7925208
1 changed files with 20 additions and 13 deletions

View File

@ -2060,7 +2060,6 @@ static void get_nc_options(const request *user_r)
static nc_type translate_nctype(const char *name) static nc_type translate_nctype(const char *name)
{ {
if(!name) if(!name)
return NC_SHORT; return NC_SHORT;
@ -2175,7 +2174,6 @@ static int def_latlon(int ncid, fieldset *fs)
release_field(g); release_field(g);
(void)var_id; /* suppress gcc warning */ (void)var_id; /* suppress gcc warning */
return e; return e;
} }
@ -2487,45 +2485,55 @@ static void scale_bitmap(double *vals, long n, void *data, dataset_t *subset)
case NC_BYTE: case NC_BYTE:
{ {
unsigned char *vscaled = (unsigned char *) data; unsigned char *vscaled = (unsigned char *) data;
for(i = 0; i < n; ++i) for(i = 0; i < n; ++i){
if(vals[i] == global_missing_value) if(vals[i] == global_missing_value){
vscaled[i] = (unsigned char) subset->missing; vscaled[i] = (unsigned char) subset->missing;
}
}
break; break;
} }
case NC_SHORT: case NC_SHORT:
{ {
short int *vscaled = (short int *) data; short int *vscaled = (short int *) data;
for(i = 0; i < n; ++i) for(i = 0; i < n; ++i){
if(vals[i] == global_missing_value) if(vals[i] == global_missing_value){
vscaled[i] = (short int) subset->missing; vscaled[i] = (short int) subset->missing;
}
}
break; break;
} }
case NC_INT: case NC_INT:
{ {
int *vscaled = (int *) data; int *vscaled = (int *) data;
for(i = 0; i < n; ++i) for(i = 0; i < n; ++i){
if(vals[i] == global_missing_value) if(vals[i] == global_missing_value){
vscaled[i] = (int) subset->missing; vscaled[i] = (int) subset->missing;
}
}
break; break;
} }
case NC_FLOAT: case NC_FLOAT:
{ {
float *vscaled = (float *) data; float *vscaled = (float *) data;
for(i = 0; i < n; ++i) for(i = 0; i < n; ++i){
if(vals[i] == global_missing_value) if(vals[i] == global_missing_value){
vscaled[i] = (float) subset->missing; vscaled[i] = (float) subset->missing;
}
}
break; break;
} }
case NC_DOUBLE: case NC_DOUBLE:
{ {
double *vscaled = (double *) data; double *vscaled = (double *) data;
for(i = 0; i < n; ++i) for(i = 0; i < n; ++i){
if(vals[i] == global_missing_value) if(vals[i] == global_missing_value){
vscaled[i] = (double) subset->missing; vscaled[i] = (double) subset->missing;
}
}
break; break;
} }
@ -2533,7 +2541,6 @@ static void scale_bitmap(double *vals, long n, void *data, dataset_t *subset)
grib_context_log(ctx, GRIB_LOG_ERROR, "scale(...): Unknown netcdf type %d", nctype); grib_context_log(ctx, GRIB_LOG_ERROR, "scale(...): Unknown netcdf type %d", nctype);
break; break;
} }
} }
static void scale(double *vals, long n, void *data, dataset_t *g) static void scale(double *vals, long n, void *data, dataset_t *g)