title: How to convert netCDF4 file in an ASCII format file for a special grid point in Python?
body: <p>I try to convert my data from a big netCDF file to an ascii format file for a special point (68,21). When I tried to run the following:</p>
  
  <pre><code>from pylab import *
  from netCDF4 import Dataset
  import pandas as pd
  
  nc = Dataset("/home/python/PBLH_Exp_08_Jul_2006.nc")
  
  PBLH = nc.variables['PBLH'][:,:,:]
  Times = nc.variables['Times'][:,:]
  
  d={}
  d['Times'] = Times[:,0]
  d['PBLH'] = PBLH[:,:,1]
  
  df=pd.DataFrame(d)
  df.to_csv('Produkt/PBLH_Exp_08_Jul_2006.csv')
  </code></pre>
  
  <p>I got the error message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/python/wrf_map.py", line 62, in &lt;module&gt;
      df=pd.DataFrame(d)
    File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 226, in __init__
      mgr = self._init_dict(data, index, columns, dtype=dtype)
    File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 363, in _init_dict
  dtype=dtype)
    File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 5163, in _arrays_to_mgr
      arrays = _homogenize(arrays, index, dtype)
    File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 5477, in _homogenize
  raise_cast_failure=False)
    File "/usr/local/lib/python2.7/dist-packages/pandas/core/series.py", line 2885, in _sanitize_array
      raise Exception('Data must be 1-dimensional')
  Exception: Data must be 1-dimensional
  </code></pre>
  
  <p>What can I do to solve this issue? And how can I extract the data for my grid point? By the way, here is a part of the header of my netCDF file:</p>
  
  <pre><code>&lt;xarray.Dataset&gt;
  Dimensions:      (Time: 744, south_north: 140, west_east: 140)
  Coordinates:
  
    * Time         (Time) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
    * south_north  (south_north) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...
    * west_east    (west_east) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...
  Data variables:
      Times        (Time) |S19 '2006-07-01_01:00:00' '2006-07-01_02:00:00' ...
      PBLH         (Time, south_north, west_east) float32 59.9834 59.8574 ...
  </code></pre>
  
  <p>Thanks for any help!!</p>