Skip to content

Commit

Permalink
Merge branch 'dataobj' of github.com:icesat2py/icepyx into dataobj
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaS11 committed Sep 30, 2021
2 parents 839093d + d859f28 commit c04bfbb
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 26 deletions.
49 changes: 49 additions & 0 deletions examples/ICESat-2_DAAC_DataAccess_Example.ipynb
Expand Up @@ -10,12 +10,15 @@
"\n",
"#### Credits\n",
"* original notebook by: Jessica Scheick\n",
<<<<<<< HEAD
<<<<<<< HEAD
"* notebook contributors: Tyler Sutterley\n",
"* source material: [NSIDC Data Access Notebook](https://github.com/ICESAT-2HackWeek/ICESat2_hackweek_tutorials/tree/master/03_NSIDCDataAccess_Steiker) by Amy Steiker and Bruce Wallin\n"
],
"metadata": {}
=======
=======
>>>>>>> d859f28119be31e93f3754d480333352536ef6eb
"* notebook contributors: Amy Steiker and Tyler Sutterley\n",
"* source material: [NSIDC Data Access Notebook](https://github.com/ICESAT-2HackWeek/ICESat2_hackweek_tutorials/tree/master/03_NSIDCDataAccess_Steiker) by Amy Steiker and Bruce Wallin and [2020 Hackweek Data Access Notebook](https://github.com/ICESAT-2HackWeek/2020_ICESat-2_Hackweek_Tutorials/blob/main/06-07.Data_Access/02-Data_Access_rendered.ipynb) by Jessica Scheick and Amy Steiker"
]
Expand Down Expand Up @@ -50,6 +53,16 @@
"sys."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys."
]
},
{
"cell_type": "markdown",
"source": [
Expand Down Expand Up @@ -85,6 +98,23 @@
"icepyx streamlines this process into a minimal number of lines of code."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Key Steps for Programmatic Data Access\n",
"\n",
"There are several key steps for accessing data from the NSIDC API:\n",
"1. Define your parameters (spatial, temporal, dataset, etc.)\n",
"2. Query the NSIDC API to find out more information about the dataset\n",
"3. Log in to NASA Earthdata\n",
"4. Define additional parameters (e.g. subsetting/customization options)\n",
"5. Order your data\n",
"6. Download your data\n",
"\n",
"icepyx streamlines this process into a minimal number of lines of code."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -233,9 +263,15 @@
"- `end_time` = end time for the end date of the temporal search parameter. If no input is given, this defaults to 23:59:59. Times must be input as 'HH:mm:ss' strings.\n",
"- `version` = What version of the data product to use, input as a numerical string. If no input is given, this value defaults to the most recent version of the product specified in `short_name`.\n",
"\n",
<<<<<<< HEAD
"\n",
"if you try to download too old a version from NSIDC (i.e. it's no longer hosted by them), you'll get a \"no data matched your request error\"\n",
"\n",
=======
"\n",
"if you try to download too old a version from NSIDC (i.e. it's no longer hosted by them), you'll get a \"no data matched your request error\"\n",
"\n",
>>>>>>> d859f28119be31e93f3754d480333352536ef6eb
"*NOTE Version 002 is used as an example in the below cell. However, using it will cause 'no results' errors in granule ordering for some search parameters. These issues have been resolved in later versions of the data products, so it is best to use the most recent version where possible.\n",
"Similarly, if you try to order/download too old a version (such that it is no longer hosted by NSIDC), you will get a \"no data matched your request\" error.\n",
"Thus, you will need to update the version associated with `region_a` and rerun the next cell for the rest of this notebook to run.*"
Expand Down Expand Up @@ -432,20 +468,33 @@
"cell_type": "markdown",
"source": [
"#### Subsetting\n",
<<<<<<< HEAD
"\n",
"In addition to the required parameters (CMRparams and reqparams) that are submitted with our order, for ICESat-2 data products we can also submit subsetting parameters to NSIDC.\n",
"For a deeper dive into subsetting, please see our [Subsetting Tutorial Notebook](https://github.com/icesat2py/icepyx/blob/main/doc/examples/ICESat-2_DAAC_DataAccess2_Subsetting.ipynb), which covers subsetting in more detail, including how to get a list of subsetting options, how to build your list of subsetting parameters, and how to generate a list of desired variables (most datasets have more than 200 variable fields!), including using pre-built default lists (these lists are still in progress and we welcome contributions!).\n",
"\n",
=======
"\n",
"In addition to the required parameters (CMRparams and reqparams) that are submitted with our order, for ICESat-2 data products we can also submit subsetting parameters to NSIDC.\n",
"For a deeper dive into subsetting, please see our [Subsetting Tutorial Notebook](https://github.com/icesat2py/icepyx/blob/main/doc/examples/ICESat-2_DAAC_DataAccess2_Subsetting.ipynb), which covers subsetting in more detail, including how to get a list of subsetting options, how to build your list of subsetting parameters, and how to generate a list of desired variables (most datasets have more than 200 variable fields!), including using pre-built default lists (these lists are still in progress and we welcome contributions!).\n",
"\n",
>>>>>>> d859f28119be31e93f3754d480333352536ef6eb
"Subsetting utilizes the NSIDC's built in subsetter to extract only the data you are interested (spatially, temporally, variables of interest, etc.). The advantages of using the NSIDC's subsetter include:\n",
"* easily reproducible downloads, particularly when coupled with an icepyx query object\n",
"* smaller file size, meaning faster downloads, less storage required, and no need to subset the data on your own\n",
"* still easy to go back and order more data/variables with the same or similar search parameters\n",
"* no extraneous data means you can move directly to analysis and easily navigate your dataset\n",
"\n",
"Certain subset parameters are specified by default unless `subset=False` is included as an input to `order_granules()` or `download_granules()` (which calls `order_granules()` under the hood). A separate, companion notebook tutorial covers subsetting in more detail, including how to get a list of subsetting options, how to build your list of subsetting parameters, and how to generate a list of desired variables (most products have more than 200 variable fields!), including using pre-built default lists (these lists are still in progress and we welcome contributions!).\n",
<<<<<<< HEAD
"\n",
"As for the CMR and required parameters, default subset parameters can be built and viewed using `subsetparams`. Where an input spatial file is used, rather than a bounding box or manually entered polygon, the spatial file will be used for subsetting (unless subset is set to False) but not show up in the `subsetparams` dictionary.\n",
"\n",
=======
"\n",
"As for the CMR and required parameters, default subset parameters can be built and viewed using `subsetparams`. Where an input spatial file is used, rather than a bounding box or manually entered polygon, the spatial file will be used for subsetting (unless subset is set to False) but not show up in the `subsetparams` dictionary.\n",
"\n",
>>>>>>> d859f28119be31e93f3754d480333352536ef6eb
"icepyx also makes it easy to take advantage of the reformatting (e.g. file format conversion) options offered by NSIDC. These are covered in more detail in the [Subsetting Tutorial Notebook](https://github.com/icesat2py/icepyx/blob/main/doc/examples/ICESat-2_DAAC_DataAccess2_Subsetting.ipynb)."
]
},
Expand Down
2 changes: 1 addition & 1 deletion icepyx/core/is2ref.py
Expand Up @@ -248,7 +248,7 @@ def _default_varlists(product):

else:
print(
"THE REQUESTED PRODUCT DOES NOT YET HAVE A DEFAULT LIST SET UP. ONLY DELTA_TIME, LATITUDE, AND LONGITUDE WILL BE RETURNED"
"THE REQUESTED DATASET DOES NOT YET HAVE A DEFAULT LIST SET UP. ONLY DELTA_TIME, LATITUDE, AND LONGITUDE WILL BE RETURNED"
)
return common_list

Expand Down
25 changes: 0 additions & 25 deletions icepyx/core/query.py
Expand Up @@ -504,31 +504,6 @@ def order_vars(self):

return self._order_vars

@property
def file_vars(self):
"""
Return the file variables object.
This instance is generated when files are used to create the data object (not yet implemented).
See Also
--------
variables.Variables
Examples
--------
>>> reg_a = icepyx.query.Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> reg_a.earthdata_login(user_id,user_email)
Earthdata Login password: ········
>>> reg_a.file_vars
<icepyx.core.variables.Variables at [location]>
"""

if not hasattr(self, "_file_vars"):
if self._source == "file":
self._file_vars = Variables(self._source, product=self.product)

return self._file_vars

@property
def granules(self):
"""
Expand Down

0 comments on commit c04bfbb

Please sign in to comment.