title: extracting station data from zipped netCDF files
body: <p>I have created a spatial dataset with 3-daily resolution over some period (2018-2021) in netCDF format, meaning I have ~300 files from where I want to extract data.</p>
  <p>Unfortunately, due to size issues, I had to zip the dataset with zip_1 option using cdo and now I need to extract station data over several points (approximately 20 stations) and it takes a lot of time to extract even one point from one file.</p>
  <p>My question is whether there is a chance to speed this process with some command using nco or cdo? I mean during one loop over the 3-daily file to extract all the stations that I need.</p>
  <p>At the moment I just loop over the stations and then over the files, but as it takes XX seconds for cdo to extract 3-days for one station, the total will be 20 times 300 times XX seconds (several days).</p>
  <p>This is my code so far:</p>
  <pre><code>#!/usr/bin/env ipython
  # -----------------------
  import numpy as np
  from netCDF4 import Dataset,date2num,num2date
  import os, glob, subprocess
  # ------------------------
  stations={'S01':[25.0+1./60,59.0+43/60.0],'S02':[21.0+5.0/60,59.0+2/60.0]} # list of stations
  # ----------------------------------------------------------------------------------------
  pathin = os.getcwd() + '/' # the location of data
  tmpdir = os.getcwd() + '/tmp/' # some temporary folder where to write temporary files
  files = sorted(glob.glob(pathin+'/*/*mean_*nc4')); # files containing data (my large dataset)
  # -------------------------
  dum=[stations[key].extend(mygrid.get_locid(*stations[key])) for key in stations.keys()]; # append the indices from where I want to have output (station coordinates as indices)
  # -------------------------
  for statname in stations.keys(): # loop over the stations
      iiout=stations[statname][-1];jjout=stations[statname][-2]; # use the indices
      indexbox=[str(iiout+1),str(iiout+1),str(jjout+1),str(jjout+1)];boxstr = ','.join(indexbox) # make the index box
      for fname in files: # loop over all the files
          fin = fname # input file
          fout = tmpdir + '/' + 'stat_'+statname+'_'+os.path.basename(fname) # write to some temporary file
          # ---------------------------------------------------
          cstr = 'cdo -selindexbox,'+boxstr+' '+fin+' '+fout; # use cdo to extract data
          if os.path.exists(fout)==False: subprocess.call(cstr,shell=True); # call cdo 
      # -------------------------------------------------------
      # let us merge temporaray files of the station:
      tmpfiles = tmpdir + '/*'+statname+'*'
      mainfile = 'statdata_'+staname+'.nc'
      cstr = 'cdo -mergetime '+tmpfiles + ' '+mainfile;
      subprocess.call(cstr,shell=True);
      # -------------------------------------------------------
  </code></pre>