Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csppfetch
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cspp_geo
csppfetch
Commits
6bda3197
Commit
6bda3197
authored
3 years ago
by
Alan De Smet
Browse files
Options
Downloads
Patches
Plain Diff
Break up docs
parent
6f55db58
Branches
sphinx
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
docs/examples.rst
+49
-0
49 additions, 0 deletions
docs/examples.rst
docs/genindex.rst
+2
-0
2 additions, 0 deletions
docs/genindex.rst
docs/intro.rst
+5
-0
5 additions, 0 deletions
docs/intro.rst
docs/usage.rst
+30
-0
30 additions, 0 deletions
docs/usage.rst
with
86 additions
and
0 deletions
docs/examples.rst
0 → 100644
+
49
−
0
View file @
6bda3197
Examples
========
Setup
-----
>>> import csppfetch
>>> import datetime
>>> sst_filename = "avhrr-only-v2.%Y%m%d_preliminary.nc"
>>> sst = csppfetch.Downloader(
... name = "Sea Surface Temperature",
... package_env_id = 'CSPP_GEO_AITF_',
... url_base = "https://geodb.ssec.wisc.edu/ancillary/",
... url_relative = "%Y_%m_%d_%j/"+sst_filename,
... local = sst_filename,
... period = datetime.timedelta(hours=24),
... epoch_start = datetime.datetime(2010,1,1,3,0,0)
... )
(These imports are for these examples. They're not required to use the module!)
>>> from tempfile import TemporaryDirectory
>>> import os
Download For Time
-----------------
Download files needed to process a scan at 2019-5-27 12:00:00:
>>> scan_time = datetime.datetime(2019,5,27, 12,0,0)
>>> with TemporaryDirectory() as example_dir:
... sst.download_for_time(scan_time, example_dir)
... os.path.exists(example_dir+"/avhrr-only-v2.20190527_preliminary.nc")
True
Create/Maintain Local Cache
---------------------------
Download last 7 days of files
>>> with TemporaryDirectory() as example_dir:
... sst.mirror(example_dir)
... len(os.listdir(example_dir)) > 3
True
(The number of files is compared to 3 because due to vaguaries of creation and
mirroring, we are likely to get fewer, sometimes many fewer, than the ideal 6
or 7.)
This diff is collapsed.
Click to expand it.
docs/genindex.rst
0 → 100644
+
2
−
0
View file @
6bda3197
Index
========
This diff is collapsed.
Click to expand it.
docs/intro.rst
0 → 100644
+
5
−
0
View file @
6bda3197
Introduction
============
.. include:: ../README.rst
:start-line: 2
This diff is collapsed.
Click to expand it.
docs/usage.rst
0 → 100644
+
30
−
0
View file @
6bda3197
Usage
=====
See ``import csppfetch; help(csppfetch.Downloader.__init__)`` for details on
the arguments to Downloader.
TODO: Expand on WHY you'd use various options.
``csppfetch.Downloader.download_for_time`` implements the
`CSPP Geo ancillary download behavior guidelines <https://docs.google.com/document/d/1phQRbELddAl4AG2EdAvzlJOKdYD0HRu-TpD3fj7J1rA/edit?pli=1>`_.
It defaults to to abandoning a download after 30 seconds, will retry 3
failures, and waits 20 seconds between retry attempts. These can be overridden
with the environment variables ``<prefix>_TIMEOUT``, ``<prefix>_RETRIES``, and
``<prefix>_RETRY_WAIT``, where ``<prefix>`` is whatever is specified by
``package_env_id`` in the ``csppfetch.Downloader`` constructor. ``packages_env_id``
should probably end in "_ANCIL_" to best match the guidelines, so you might use
``package_env_id="CSPP_GEO_AITF_ANCIL_"`` instead of ``package_env_id="CSPP_GEO_AITF"``. Similarly,
you can replace the default URL in ``url_base`` with a comma seperated list using
the ``<prefix>_URL`` environment variable.
By default download_for_time seeks the nearest preceeding time relative to the
time passed in.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment