diff --git a/python/swiftest/swiftest/io.py b/python/swiftest/swiftest/io.py index 93bbada85..9f800559a 100644 --- a/python/swiftest/swiftest/io.py +++ b/python/swiftest/swiftest/io.py @@ -695,7 +695,7 @@ def swiftest2xr(param): elif ((param['OUT_TYPE'] == 'NETCDF_DOUBLE') or (param['OUT_TYPE'] == 'NETCDF_FLOAT')): print('\nCreating Dataset') - ds = xr.open_dataset(param['BIN_OUT'], mask_and_scale=True) + ds = xr.open_dataset(param['BIN_OUT'], mask_and_scale=False) ds = clean_string_values(param, ds) else: print(f"Error encountered. OUT_TYPE {param['OUT_TYPE']} not recognized.") diff --git a/src/netcdf/netcdf.f90 b/src/netcdf/netcdf.f90 index 8265be800..b26a1ba63 100644 --- a/src/netcdf/netcdf.f90 +++ b/src/netcdf/netcdf.f90 @@ -46,9 +46,11 @@ module subroutine netcdf_initialize_output(self, param) ! Internals logical :: fileExists integer(I4B) :: old_mode, nvar, varid, vartype - real(DP) :: nan + real(DP) :: dfill + real(SP) :: sfill - nan = ieee_value(nan, IEEE_QUIET_NAN) + dfill = ieee_value(dfill, IEEE_QUIET_NAN) + sfill = ieee_value(sfill, IEEE_QUIET_NAN) !! Create the new output file, deleting any previously existing output file of the same name call check( nf90_create(param%outfile, NF90_NETCDF4, self%ncid) ) @@ -144,7 +146,17 @@ module subroutine netcdf_initialize_output(self, param) ! Set fill mode to NaN for all variables call check( nf90_inquire(self%ncid, nVariables=nvar) ) do varid = 1, nvar - call check( nf90_def_var_fill(self%ncid, varid, 0, nan) ) + call check( nf90_inquire_variable(self%ncid, varid, xtype=vartype) ) + select case(vartype) + case(NF90_INT) + call check( nf90_def_var_fill(self%ncid, varid, 0, NF90_FILL_INT) ) + case(NF90_FLOAT) + call check( nf90_def_var_fill(self%ncid, varid, 0, sfill) ) + case(NF90_DOUBLE) + call check( nf90_def_var_fill(self%ncid, varid, 0, dfill) ) + case(NF90_CHAR) + call check( nf90_def_var_fill(self%ncid, varid, 0, 0) ) + end select end do return