PRO read_lare_netcdf

  path = '/Users/tibor/Desktop/collaborations/JamesLeake/FE_3D_runs/runs/fe01/data_netcdf/fe01_v4_SMD_stab_'
  time = 0170
  print, 'getting netcdf files'
  filename=path+string(time,format='(I4.4)')+'.nc'
  print, filename
  NCDF_GET,filename,'bx', result, /struct
  Bx = result.bx.value
  NCDF_GET,filename,'by', result, /struct
  By = result.by.value
  NCDF_GET,filename,'bz', result, /struct
  Bz = result.bz.value
  NCDF_GET,filename,'jx', result, /struct
  Jx = result.jx.value
  NCDF_GET,filename,'jy', result, /struct
  Jy = result.jy.value
  NCDF_GET,filename,'jz', result, /struct
  Jz = result.jz.value
  NCDF_GET,filename,'x', result, /struct
  X= result.x.value
  NCDF_GET,filename,'y', result, /struct
  Y = result.y.value
  NCDF_GET,filename,'z', result, /struct
  Z = result.z.value
  print,'z domain', min(Z), max(Z)

  index = min(where(Z ge 0.0))
  print, "surface at Z = ", Z[index] 
  set_plot, 'ps'
  device, /encapsulated, bits_per_pixel=8, /color, filename='Bz_'+string(time,format='(I4.4)')+'.eps'
  contour, Bz[*,*,index], X, Y, /fill, nlevels=101
  device, /close_file

END
