-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b64f512
commit 165cc10
Showing
9 changed files
with
119 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Functions ,Description | ||
:func:`.from_urls_file` ,parse urls from a file which only contains urls | ||
:func:`.from_file` ,parse urls from a file which only contains urls | ||
:func:`.from_html` ,parse urls from html website | ||
:func:`.from_sentinel_meta4` ,parse a urls from a given JSON file | ||
:func:`.from_EarthExplorer_order` ,parse urls from orders in earthexplorer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
=========================================== | ||
parse_urls: Parse URLs from various sources | ||
=========================================== | ||
|
||
:ref:`parse_urls` module provides basic functions to parse URLs from different sources. The module provides functions to parse URLs from: | ||
|
||
.. csv-table:: Different functions to parse URLs | ||
:file: ../api/tables/parse_urls.csv | ||
:header-rows: 1 | ||
|
||
You can import ``parse_urls`` at the beginning. | ||
|
||
.. code-block:: python | ||
from data_downloader import parse_urls | ||
Following is a brief introduction to those functions. | ||
|
||
from_file | ||
--------- | ||
|
||
This function parses URLs from a given file, which only contains URLs. | ||
|
||
.. tip:: | ||
|
||
this function is only useful when the file only contains URLs (one column). | ||
If the file contains multiple columns, you are suggested to use ``pandas`` | ||
to read the file. | ||
|
||
Example: | ||
|
||
.. code-block:: python | ||
from data_downloader import parse_urls, downloader | ||
url_file = '/media/fancy/gpm/subset_GPM_3IMERGM_06_20200513_134318.txt' | ||
urls = parse_urls.from_file(url_file) | ||
downloader.download_datas(urls, folder_out) | ||
Here is an example of use case: :ref:`gpm_example`. | ||
|
||
from_html | ||
--------- | ||
|
||
This function parses URLs from a given HTML websites (url). It can parse URLs with a specific suffix and depth. Following example shows how to parse URLs with suffix ``.nc`` and depth 1. | ||
|
||
Example: | ||
|
||
.. code-block:: python | ||
from data_downloader import parse_urls | ||
url = 'https://cds-espri.ipsl.upmc.fr/espri/pubipsl/iasib_CH4_2014_uk.jsp' | ||
urls = parse_urls.from_html(url, suffix=['.nc'], suffix_depth=1) | ||
urls_all = parse_urls.from_html(url, suffix=['.nc'], suffix_depth=1, url_depth=1) | ||
print(f"Found {len(urls)} urls, {len(urls_all)} urls in total") | ||
.. code-block:: none | ||
Found 357 urls, 2903 urls in total | ||