code: def brunt_vaisala_period(heights, potential_temperature, axis=0):
      r
      bv_freq_squared = brunt_vaisala_frequency_squared(heights, potential_temperature,
                                                        axis=axis)
      bv_freq_squared[bv_freq_squared.magnitude <= 0] = np.nan
  
      return 2 * np.pi / np.sqrt(bv_freq_squared)
docs: r"""Calculate the Brunt-Vaisala period.
  
      This function is a helper function for `brunt_vaisala_frequency` that calculates the
      period of oscilation as in Exercise 3.13 of [Hobbs2006]_:
  
      .. math:: \tau = \frac{2\pi}{N}
  
      Returns `NaN` when :math:`N^2 > 0`.
  
      Parameters
      ----------
      heights : array-like
          One-dimensional profile of atmospheric height
      potential_temperature : array-like
          Atmospheric potential temperature
      axis : int, optional
          The axis corresponding to vertical in the potential temperature array, defaults to 0.
  
      Returns
      -------
      array-like
          Brunt-Vaisala period.
  
      See Also
      --------
      brunt_vaisala_frequency, brunt_vaisala_frequency_squared, potential_temperature