netcdf: use float values for scale factors instead of double

This commit is contained in:
Luthaf
2021-12-17 10:55:54 +01:00
parent d04f428c1a
commit 4bf065ed1c
2 changed files with 8 additions and 9 deletions

View File

@ -341,7 +341,7 @@ void DumpNetCDF::openfile()
int dims[NC_MAX_VAR_DIMS]; int dims[NC_MAX_VAR_DIMS];
size_t index[NC_MAX_VAR_DIMS], count[NC_MAX_VAR_DIMS]; size_t index[NC_MAX_VAR_DIMS], count[NC_MAX_VAR_DIMS];
double d[1]; float d[1];
if (singlefile_opened) return; if (singlefile_opened) return;
singlefile_opened = 1; singlefile_opened = 1;
@ -489,11 +489,11 @@ void DumpNetCDF::openfile()
NCERR( nc_put_att_text(ncid, cell_angles_var, NC_UNITS_STR,6, "degree") ); NCERR( nc_put_att_text(ncid, cell_angles_var, NC_UNITS_STR,6, "degree") );
d[0] = update->dt; d[0] = update->dt;
NCERR( nc_put_att_double(ncid, time_var, NC_SCALE_FACTOR_STR,NC_DOUBLE, 1, d) ); NCERR( nc_put_att_float(ncid, time_var, NC_SCALE_FACTOR_STR, NC_FLOAT, 1, d) );
d[0] = 1.0; d[0] = 1.0;
NCERR( nc_put_att_double(ncid, cell_origin_var, NC_SCALE_FACTOR_STR,NC_DOUBLE, 1, d) ); NCERR( nc_put_att_float(ncid, cell_origin_var, NC_SCALE_FACTOR_STR, NC_FLOAT, 1, d) );
d[0] = 1.0; d[0] = 1.0;
NCERR( nc_put_att_double(ncid, cell_lengths_var, NC_SCALE_FACTOR_STR,NC_DOUBLE, 1, d) ); NCERR( nc_put_att_float(ncid, cell_lengths_var, NC_SCALE_FACTOR_STR, NC_FLOAT, 1, d) );
/* /*
* Finished with definition * Finished with definition

View File

@ -276,7 +276,6 @@ void DumpNetCDFMPIIO::openfile()
error->all(FLERR, "cannot append to non-existent file {}", filecurrent); error->all(FLERR, "cannot append to non-existent file {}", filecurrent);
MPI_Offset index[NC_MAX_VAR_DIMS], count[NC_MAX_VAR_DIMS]; MPI_Offset index[NC_MAX_VAR_DIMS], count[NC_MAX_VAR_DIMS];
double d[1];
if (singlefile_opened) return; if (singlefile_opened) return;
singlefile_opened = 1; singlefile_opened = 1;
@ -342,7 +341,7 @@ void DumpNetCDFMPIIO::openfile()
int dims[NC_MAX_VAR_DIMS]; int dims[NC_MAX_VAR_DIMS];
MPI_Offset index[NC_MAX_VAR_DIMS], count[NC_MAX_VAR_DIMS]; MPI_Offset index[NC_MAX_VAR_DIMS], count[NC_MAX_VAR_DIMS];
double d[1]; float d[1];
if (singlefile_opened) return; if (singlefile_opened) return;
singlefile_opened = 1; singlefile_opened = 1;
@ -474,11 +473,11 @@ void DumpNetCDFMPIIO::openfile()
NCERR( ncmpi_put_att_text(ncid, cell_angles_var, NC_UNITS_STR, 6, "degree") ); NCERR( ncmpi_put_att_text(ncid, cell_angles_var, NC_UNITS_STR, 6, "degree") );
d[0] = update->dt; d[0] = update->dt;
NCERR( ncmpi_put_att_double(ncid, time_var, NC_SCALE_FACTOR_STR, NC_DOUBLE, 1, d) ); NCERR( ncmpi_put_att_float(ncid, time_var, NC_SCALE_FACTOR_STR, NC_FLOAT, 1, d) );
d[0] = 1.0; d[0] = 1.0;
NCERR( ncmpi_put_att_double(ncid, cell_origin_var, NC_SCALE_FACTOR_STR, NC_DOUBLE, 1, d) ); NCERR( ncmpi_put_att_float(ncid, cell_origin_var, NC_SCALE_FACTOR_STR, NC_FLOAT, 1, d) );
d[0] = 1.0; d[0] = 1.0;
NCERR( ncmpi_put_att_double(ncid, cell_lengths_var, NC_SCALE_FACTOR_STR, NC_DOUBLE, 1, d) ); NCERR( ncmpi_put_att_float(ncid, cell_lengths_var, NC_SCALE_FACTOR_STR, NC_FLOAT, 1, d) );
/* /*
* Finished with definition * Finished with definition