title: "vobjtovarid4: error #F: I could not find the requsted var (or dimvar) in the file!"
body: <p>I am trying to get specific variables out of a NETcdf file using ncdf4 and the ncvar_get() function. When I open the file and print() it I can see the available variables but when I try get them out I get </p>
  
  <blockquote>
    <p>"vobjtovarid4: error #F: I could not find the requsted var (or dimvar)
    in the file!"</p>
    
    <p>[1] "var (or dimvar) name: precipitation"</p>
    
    <p>[1] "file name: /Users/megmccann/Documents/Prec data/Prec
    data/cru_ts3.24.1901.2015.pre.dat.nc"</p>
    
    <p>Error in vobjtovarid4(nc, varid, verbose = verbose, allowdimvar =
    TRUE) :    Variable not found</p>
  </blockquote>
  
  <p>Here is my script:</p>
  
  <blockquote>
    <p>prec.ex.nc &lt;- nc_open("/Users/megmccann/Documents/Prec data/Prec data/cru_ts3.24.1901.2015.pre.dat.nc")</p>
    
    <p>print(prec.ex.nc)</p>
  </blockquote>
  
  <p>File /Users/megmccann/Documents/Prec data/Prec data/cru_ts3.24.1901.2015.pre.dat.nc (NC_FORMAT_CLASSIC):</p>
  
  <pre><code> 1 variables (excluding dimension variables):
      double pre[lon,lat,time]   
          long_name: precipitation
          units: mm/month
          correlation_decay_distance: 450
          _FillValue: 9.96920996838687e+36
          missing_value: 9.96920996838687e+36
  
   3 dimensions:
      lon  Size:720
          long_name: longitude
          units: degrees_east
      lat  Size:360
          long_name: latitude
          units: degrees_north
      time  Size:1380   *** is unlimited ***
          long_name: time
          units: days since 1900-1-1
          calendar: gregorian
  
  9 global attributes:
      Conventions: CF-1.4
      title: CRU TS3.24 Precipitation
      institution: Data held at British Atmospheric Data Centre, RAL, UK.
      source: Run ID = 1610031104
  </code></pre>
  
  <p>Data generated by BADC from:
  pre.1609291528.dtb
          history: Wed 19 Oct 2016 10:53:41 BST : User ianharris : Program makegridsauto.for called by update.for
          references: Information on the data is available at <a href="http://badc.nerc.ac.uk/data/cru/" rel="nofollow noreferrer">http://badc.nerc.ac.uk/data/cru/</a>
          comment: Access to these data is available to any registered CEDA user.
          contact: BADC 
          acknowledgement: This update was supported by NERC NCAS and by NERC SMURPHS (NE/N006348/1)</p>
  
  <blockquote>
    <p>precipitation &lt;- ncvar_get(prec.ex.nc, "precipitation")</p>
    
    <p>longitude &lt;- ncvar_get(prec.ex.nc, "longitude")</p>
    
    <p>latitude &lt;- ncvar_get(prec.ex.nc, "latitude")</p>
    
    <p>t &lt;- ncvar_get(prec.ex.nc, "time")</p>
  </blockquote>
  
  <p>Where I get the error code for all variables except time?
  I used the exact same code for a different NETcdf file for Temperature_anomalies and it worked fine? </p>