Page tree
Skip to end of metadata
Go to start of metadata

Depending on the difference between the minimum and maximum and the value resolution of a netcdf variable, a smaller sized integer variable like short or byte can be used to compact the data. A scale factor and offset will be used to fit the data in the smaller sized variable and will added to the netCDF variable as attributes with names scale_factor and add_offset. All standard netCDF viewers will take these attributes into account automatically, but other tools and especially scripts might not. 

Compacting netCDF variables for different export from FEWS: 

 

Variable compacted to short data type
   short waterlevel(time, stations);
     waterlevel:standard_name = "water_surface_height_above_reference_datum detection_minimum";
     waterlevel:long_name = "waterlevel";
     waterlevel:units = "m";
     waterlevel:_FillValue = -32768S;
     waterlevel:scale_factor = 0.01f;
     waterlevel:add_offset = 0.0f;
     waterlevel:coordinates = "lat lon";
     waterlevel:cell_methods = "time: maximum";

 
waterlevel =
  {
    {-32768, 121, 131, 141, 151, 161},
    {-32768, 221, 231, 241, 251, 261},
    {-32768, 321, 331, 341, 351, 361}
  }
Uncompacted data type
   float waterlevel(time, stations);
     waterlevel:standard_name = "water_surface_height_above_reference_datum detection_minimum";
     waterlevel:long_name = "waterlevel";
     waterlevel:units = "m";
     waterlevel:_FillValue = -9999.0f;
     waterlevel:coordinates = "lat lon";
     waterlevel:cell_methods = "time: maximum";
 

waterlevel =
  {
    {-9999.0, 1.21, 1.31, 1.41, 1.51, 1.61},
    {-9999.0, 2.21, 2.31, 2.41, 2.51, 2.61},
    {-9999.0, 3.21, 3.31, 3.41, 3.51, 3.61}
  }
  • No labels