@@ -0,0 +1,1220 @@
+import netCDF4%0Aimport pandas as pd%0A%0Afilename='SBE_CTD_August2016_downcast'%0Anc = netCDF4.Dataset(filename+'.nc')%0A%0A# read all dimensions and variables%0Anc_dims = %5Bdim for dim in nc.dimensions%5D%0Anc_vars = %5Bvar for var in nc.variables%5D%0A%0A# loop over all variables and store all with type float64 and two dimensions (profile and nzMax)%0AcastVars = %5B%5D%0Afor var in nc_vars:%0A    if var not in nc_dims:%0A        if len(nc.variables%5Bvar%5D.dimensions) == 2:%0A            if str(nc.variables%5Bvar%5D.dtype) == 'float64':%0A                print 'var with 2 dimensions: ' + var + ' type: '+ str(nc.variables%5Bvar%5D.dtype)%0A                castVars+=%5Bvar%5D%0A%0A# extract profiles and loop over profiles..%0Aprofile_arr = nc.variables%5B'profile'%5D%5B:%5D%0Afor i, profile in enumerate(profile_arr):%0A    # ..for every profile, read profile data for all variables%0A    d = %7B%7D%0A    for j, var in enumerate(castVars):%0A        d%5Bvar%5D = nc.variables%5Bvar%5D%5Bi,:%5D%0A    # convert to pandas dataframe%0A    df = pd.DataFrame(d)%0A    # give pandas index column a name%0A    df.index.name = 'Index'%0A    # drop all rows with empty data (shallow casts)%0A    df = df.dropna(how='all', subset=castVars)%0A    # store cast data in CSV file%0A    df.to_csv(filename+ '_cast_'+ str(i) +'.csv')%0A    %0A

Create export_casts.py