Use nanmin and nanmax in write_parameter_ranges