docs: def write_file(self, strain, scaling_factor=1E-9):
          '''
          Main writer function for the csv file
  
          :param strain:
              Instance of :class: openquake.hmtk.strain.geodetic_strain.GeodeticStrain
          :param float scaling_factor:
              Scaling factor used for all strain values (default 1E-9 for
              nanostrain)
          '''
          if not isinstance(strain, GeodeticStrain):
              raise ValueError('Strain data must be instance of GeodeticStrain')
  
          for key in strain.data.keys():
              if key in strain.data_variables:
                  # Return strain value back to original scaling
                  if key in ['longitude', 'latitude']:
                      continue
                  strain.data[key] = strain.data[key] / scaling_factor
  
          # Slice seismicity rates into separate dictionary vectors
          strain, output_variables = self.slice_rates_to_data(strain)
  
          outfile = open(self.filename, 'wt')
          print('Writing strain data to file %s' % self.filename)
          writer = csv.DictWriter(outfile,
                                  fieldnames=output_variables)
          writer.writeheader()
          for iloc in range(0, strain.get_number_observations()):
              row_dict = {}
              for key in output_variables:
                  if len(strain.data[key]) > 0:
                      # Ignores empty dictionary attributes
                      row_dict[key] = strain.data[key][iloc]
              writer.writerow(row_dict)
          outfile.close()
          print('done!')