<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to use the Python SDK to download netcdf files in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/How-to-use-the-Python-SDK-to-download-netcdf-files/m-p/380900#M866</link>
    <description>&lt;P&gt;The &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.files_download" target="_self"&gt;&lt;CODE&gt;files_download&lt;/CODE&gt;&lt;/A&gt; method gives you a &lt;A href="https://2.python-requests.org/en/master/api/#requests.Response" target="_self"&gt;&lt;CODE&gt;requests.Response&lt;/CODE&gt;&lt;/A&gt; object that you can read from, optionally in pieces, without downloading the entire file to your local filesystem.&lt;/P&gt;
&lt;P&gt;For example, you might want to read it a piece at a time, like:&lt;/P&gt;
&lt;PRE&gt;metadata, f = dbx.files_download(path)

for partial_data in f.iter_content(chunk_size=1024):
    print(partial_data)
    raw_input()  # whatever you need to do&lt;/PRE&gt;
&lt;P&gt;I can't offer help with&amp;nbsp;netCDF4 or xarray though, as those are not made by Dropbox.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Nov 2019 14:32:44 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2019-11-26T14:32:44Z</dc:date>
    <item>
      <title>How to use the Python SDK to download netcdf files</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/How-to-use-the-Python-SDK-to-download-netcdf-files/m-p/380837#M865</link>
      <description>&lt;P&gt;I have some large netcdf4 files in my personal Dropbox on the order of about 12GB. I'd like to use the Python SDK to read these files directly into my session without having to download them locally but am not sure how to use the Response object that gets returned by files_download()? I work with .nc files primarily with the `xarray` package, so was wondering what the best way to get from the Response object specified by my path to a xarray object would be. The code I currently have is below.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;import dropbox 
import netCDF4
import xarray as xr

access_token = XXXXXX
dbx = dropbox.Dropbox(access_token)
db_path = "/MAXT.nc"
metadata, f = dbx.files_download(db_path)&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Dec 2019 19:59:53 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/How-to-use-the-Python-SDK-to-download-netcdf-files/m-p/380837#M865</guid>
      <dc:creator>tXiao95</dc:creator>
      <dc:date>2019-12-26T19:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Python SDK to download netcdf files</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/How-to-use-the-Python-SDK-to-download-netcdf-files/m-p/380900#M866</link>
      <description>&lt;P&gt;The &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.files_download" target="_self"&gt;&lt;CODE&gt;files_download&lt;/CODE&gt;&lt;/A&gt; method gives you a &lt;A href="https://2.python-requests.org/en/master/api/#requests.Response" target="_self"&gt;&lt;CODE&gt;requests.Response&lt;/CODE&gt;&lt;/A&gt; object that you can read from, optionally in pieces, without downloading the entire file to your local filesystem.&lt;/P&gt;
&lt;P&gt;For example, you might want to read it a piece at a time, like:&lt;/P&gt;
&lt;PRE&gt;metadata, f = dbx.files_download(path)

for partial_data in f.iter_content(chunk_size=1024):
    print(partial_data)
    raw_input()  # whatever you need to do&lt;/PRE&gt;
&lt;P&gt;I can't offer help with&amp;nbsp;netCDF4 or xarray though, as those are not made by Dropbox.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 14:32:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/How-to-use-the-Python-SDK-to-download-netcdf-files/m-p/380900#M866</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-11-26T14:32:44Z</dc:date>
    </item>
  </channel>
</rss>

