class_docstr: Class capable of writing daily OHLCV data to disk in a format that
  can be read efficiently by HDF5DailyBarReader.
  
  Parameters
  ----------
  filename : str
      The location at which we should write our output.
  date_chunk_size : int
      The number of days per chunk in the HDF5 file. If this is
      greater than the number of days in the data, the chunksize will
      match the actual number of days.
  
  See Also
  --------
  zipline.data.hdf5_daily_bars.HDF5DailyBarReader
class_docstr_tok: ["Class","capable","of","writing","daily","OHLCV","data","to","disk","in","a","format","that","can","be","read","efficiently","by","HDF5DailyBarReader",".","Parameters","--","--","--","--","--","filename",":","str","The","location","at","which","we","should","write","our","output",".","date_chunk_size",":","int","The","number","of","days","per","chunk","in","the","HDF5","file",".","If","this","is","greater","than","the","number","of","days","in","the","data",",","the","chunksize","will","match","the","actual","number","of","days",".","See","Also","--","--","--","--","zipline.data.hdf5_daily_bars.HDF5DailyBarReader"]
docstr: Write the OHLCV data for one country to the HDF5 file.
  
  Parameters
  ----------
  country_code : str
      The ISO 3166 alpha-2 country code for this country.
  frames : dict[str, pd.DataFrame]
      A dict mapping each OHLCV field to a dataframe with a row
      for each date and a column for each sid. The dataframes need
      to have the same index and columns.
  currency_codes : pd.Series, optional
      Series mapping sids to 3-digit currency code values for those sids'
      listing currencies. If not passed, missing currencies will be
      written.
  scaling_factors : dict[str, float], optional
      A dict mapping each OHLCV field to a scaling factor, which
      is applied (as a multiplier) to the values of field to
      efficiently store them as uint32, while maintaining desired
      precision. These factors are written to the file as metadata,
      which is consumed by the reader to adjust back to the original
      float values. Default is None, in which case
      DEFAULT_SCALING_FACTORS is used.
docstr_tok: ["Write","the","OHLCV","data","for","one","country","to","the","HDF5","file",".","Parameters","--","--","--","--","--","country_code",":","str","The","ISO","3166","alpha-2","country","code","for","this","country",".","frames",":","dict","[","str",",","pd.DataFrame","]","A","dict","mapping","each","OHLCV","field","to","a","dataframe","with","a","row","for","each","date","and","a","column","for","each","sid",".","The","dataframes","need","to","have","the","same","index","and","columns",".","currency_codes",":","pd.Series",",","optional","Series","mapping","sids","to","3-digit","currency","code","values","for","those","sids'","listing","currencies",".","If","not","passed",",","missing","currencies","will","be","written",".","scaling_factors",":","dict","[","str",",","float","]",",","optional","A","dict","mapping","each","OHLCV","field","to","a","scaling","factor",",","which","is","applied","(","as","a","multiplier",")","to","the","values","of","field","to","efficiently","store","them","as","uint32",",","while","maintaining","desired","precision",".","These","factors","are","written","to","the","file","as","metadata",",","which","is","consumed","by","the","reader","to","adjust","back","to","the","original","float","values",".","Default","is","None",",","in","which","case","DEFAULT_SCALING_FACTORS","is","used","."]
code: def write(
      self,
      country_code,
      frames,
      currency_codes=None,
      scaling_factors=None,
  ):
      """
      Write the OHLCV data for one country to the HDF5 file.
  
      Parameters
      ----------
      country_code : str
          The ISO 3166 alpha-2 country code for this country.
      frames : dict[str, pd.DataFrame]
          A dict mapping each OHLCV field to a dataframe with a row
          for each date and a column for each sid. The dataframes need
          to have the same index and columns.
      currency_codes : pd.Series, optional
          Series mapping sids to 3-digit currency code values for those sids'
          listing currencies. If not passed, missing currencies will be
          written.
      scaling_factors : dict[str, float], optional
          A dict mapping each OHLCV field to a scaling factor, which
          is applied (as a multiplier) to the values of field to
          efficiently store them as uint32, while maintaining desired
          precision. These factors are written to the file as metadata,
          which is consumed by the reader to adjust back to the original
          float values. Default is None, in which case
          DEFAULT_SCALING_FACTORS is used.
      """
      if scaling_factors is None:
          scaling_factors = DEFAULT_SCALING_FACTORS
  
      # Note that this functions validates that all of the frames
      # share the same days and sids.
      days, sids = days_and_sids_for_frames(list(frames.values()))
  
      # XXX: We should make this required once we're using it everywhere.
      if currency_codes is None:
          currency_codes = pd.Series(index=sids, data=MISSING_CURRENCY)
  
      # Currency codes should match dataframe columns.
      check_sids_arrays_match(
          sids,
          currency_codes.index.values,
          message="currency_codes sids do not match data sids:",
      )
  
      # Write start and end dates for each sid.
      start_date_ixs, end_date_ixs = compute_asset_lifetimes(frames)
  
      if len(sids):
          chunks = (len(sids), min(self._date_chunk_size, len(days)))
      else:
          # h5py crashes if we provide chunks for empty data.
          chunks = None
  
      with self.h5_file(mode="a") as h5_file:
          # ensure that the file version has been written
          h5_file.attrs["version"] = VERSION
  
          country_group = h5_file.create_group(country_code)
  
          self._write_index_group(country_group, days, sids)
          self._write_lifetimes_group(
              country_group,
              start_date_ixs,
              end_date_ixs,
          )
          self._write_currency_group(country_group, currency_codes)
          self._write_data_group(
              country_group,
              frames,
              scaling_factors,
              chunks,
          )
  
imports: from functools import partial
  import h5py
  import logbook
  import numpy
  import pandas
  from six import iteritems, raise_from, viewkeys
  from six.moves import reduce
  from zipline.data.bar_reader import NoDataAfterDate, NoDataBeforeDate, NoDataForSid, NoDataOnDate
  from zipline.data.session_bars import CurrencyAwareSessionBarReader
  from zipline.utils.memoize import lazyval
  from zipline.utils.numpy_utils import bytes_array_to_native_str_object_array
  from zipline.utils.pandas_utils import check_indexes_all_same
label_desc: Use image node_id 3 for calling the HDF5DailyBarWriter obj's underlying member method code with example usage: obj.write(country_code, frames, currency_codes, scaling_factors) without return types