From 176cfae9112ffc9b9ff8786d2c845aebcae1609d Mon Sep 17 00:00:00 2001 From: Li Kui Date: Tue, 1 Oct 2024 16:29:27 -0700 Subject: [PATCH] update_data_disc module add time block --- _freeze/mod_data-disc/execute-results/html.json | 4 ++-- mod_data-disc.qmd | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/_freeze/mod_data-disc/execute-results/html.json b/_freeze/mod_data-disc/execute-results/html.json index c95d14c..ea9d53b 100644 --- a/_freeze/mod_data-disc/execute-results/html.json +++ b/_freeze/mod_data-disc/execute-results/html.json @@ -1,8 +1,8 @@ { - "hash": "13dc7af827ff31fc291960a880037c57", + "hash": "4a9313c5234439cc0c220327f9ffaf55", "result": { "engine": "knitr", - "markdown": "---\ntitle: \"Data Discovery & Management\"\ncode-annotations: hover\ncode-overflow: wrap\n---\n\n\n\n\n## Overview\n\nSynthesis projects often begin with a few datasets that inspire the questions--and end up incorporating dozens or hundreds of others. Researchers may seek out data that resemble their initial datasets, but come from other climates, ecosystems, or cultural settings. Or they may find that they need data of a completely different kind to establish drivers and context. The best synthesizers are resourceful in their search for data, cautious in evaluating data quality and relevance, and meticulous in documenting data sources, treatments, and related analytical decisions. In this workshop, we will cover all these aspects in enough depth for participants to begin finding and assessing their own project data.\n\n## Learning Objectives\n\nAfter completing this module you will be able to:\n\n- Identify repositories \"known for\" a particular type of data\n- Explain how to effectively search for data outside of specialized repositories\n- Create a data inventory for identified data that allows for easy re-finding of those data products\n- Plan how to download data in a reproducible way\n- Perform checks of the fundamental structure of a dataset\n\n## Panel Discussion\n\nTo motivate this module and provide some beneficial context, we're beginning with a conversation with a panel composed of people who work at various organizations with a focus on data management and production. See the tabs below for each year's panelists and links to their professional sites.\n\nPanelists will briefly introduce themselves and describe their roles. They will then speak to the kinds of data available at their organization and the strengths, limitations, and quirks of those data products from a synthesis lens. Individuals not associated with data repositories will instead share their experience working with specific types of data. Time allowing, panelists will talk about their experiences working at their organizations more broadly.\n\n::: panel-tabset\n### 2024 Panelists\n\n- Dr. [Greg Maurer](https://greg.pronghorns.net/index.html), Environmental Data Initiative (EDI) and Jornada LTER\n- Dr. [Eric Sokol](https://www.neonscience.org/person/eric-sokol), Staff Scientist, Quantitative Ecology, National Ecological Observatory Network (NEON)\n- Dr. [Nicole Kaplan](https://www.ars.usda.gov/people-locations/person?person-id=51562), Computational Biologist, U.S. Department of Agriculture-Agricultural Research Service (USDA-ARS)\n- Dr. [Steve Formel](https://www.usgs.gov/staff-profiles/stephen-k-formel), Biologist, USGS Science, Analytics, and Synthesis Program and node manager for the Ocean Biodiversity Information System - USA (OBIS-USA) and the Global Biodiversity Information Facility US (GBIF-US)\n:::\n\n#### Pre-Prepared Questions\n\n- What policies are in place to ensure responsible use of your data?\n- What challenges (technical and scientific) do you see in integrating data across platforms and organizations?\n- Are you aware of any open sources of code useful for downloading, wrangling, or analyzing data in your repository?\n- How can young scientists and data professionals contribute to the work being done by your organizations?\n\n## Data Repositories\n\nThere are *a lot* of specialized data repositories out there. These organizations are either primarily dedicated to storing and managing data or those operations constitute a substantive proportion of their efforts. In synthesis work, you may already have some datasets in-hand at the outset but it likely that **you will need to find more data to test your hypotheses**. Data repositories are a great way of finding/accessing data that are relevant to your questions.\n\nYou'll become familiar with many of these when you need a particular type of data and go searching for it but to help speed you along, see the list below for a non-exhaustive set of some that have proved useful to other synthesis projects in the past. They are in alphabetical order. If the \"{{< fa brands r-project >}} Package\" column contains the GitHub logo ({{< fa brands github >}}) then the package is available on GitHub but is not available on CRAN (or not available at time of writing).\n\n| **Name** | **Description** | {{< fa brands r-project >}} **Package** |\n|:------------------------:|:--------------------|:------------------------:|\n| [AmeriFlux](https://ameriflux.lbl.gov/data/data-policy/) | Provides data on carbon, water, and energy fluxes in ecosystems across the Americas, aiding in climate change and carbon cycle research. | [`amerifluxr`](https://cran.r-project.org/web/packages/amerifluxr/index.html) |\n| [DataONE](https://www.dataone.org/) | Aggregates environmental and ecological data from global sources, focusing on biodiversity, climate, and ecosystem research. | [`dataone`](https://cran.r-project.org/web/packages/dataone/index.html) |\n| [EDI](https://edirepository.org/) | Contains a wide range of ecological and environmental datasets, including long-term observational data, experimental results, and field studies from diverse ecosystems. | [`EDIutils`](https://cran.r-project.org/web/packages/EDIutils/index.html) |\n| [EES-DIVE](https://ess-dive.lbl.gov/) | The Environmental System Science Data Infrastructure for a Virtual Ecosystem (ESS-DIVE) includes a variety of observational, experimental, modeling and other data products from a wide range of ecological and urban systems. | -- |\n| [GBIF](https://www.gbif.org/) | The Global Biodiversity Information Facility (GBIF) aggregates global species occurrence data and biodiversity records, supporting research in species distribution and conservation. | [`rgbif`](https://cran.r-project.org/web/packages/rgbif/index.html) |\n| [Google Earth Engine](https://earthengine.google.com/) | Google Earth Engine is a cloud-based geospatial analysis platform that provides access to vast amounts of satellite imagery and environmental data for monitoring and understanding changes in the Earth's surface. | {{< fa brands github >}} [`rgee`](https://github.com/r-spatial/rgee) |\n| [Microsoft Planetary Computer](https://planetarycomputer.microsoft.com/) | The Microsoft Planetary Computer is a cloud-based platform that combines global environmental datasets with advanced analytical tools to support sustainability and ecological research. | {{< fa brands github >}} [`rstac`](https://github.com/brazil-data-cube/rstac) |\n| [NASA](https://data.nasa.gov/) | Provides data on earth science, space exploration, and climate, including satellite imagery and observational data for both terrestrial and extraterrestrial studies. Nice GUI-based data download via [AppEEARS](https://appeears.earthdatacloud.nasa.gov/). | [`nasadata`](https://cran.r-project.org/web/packages/nasadata/index.html) |\n| [NCBI](https://www.ncbi.nlm.nih.gov/) | Hosts genomic and biological data, including DNA, RNA, and protein sequences, supporting genomics and molecular biology research. | [`rentrez`](https://cran.r-project.org/web/packages/rentrez/index.html) |\n| [NEON](https://data.neonscience.org/) | Provides ecological data from U.S. field sites, covering biodiversity, ecosystems, and environmental changes, supporting large-scale ecological research. | [`neonUtilities`](https://cran.r-project.org/web/packages/neonUtilities/index.html) |\n| [NOAA](https://data.noaa.gov/onestop/) | Offers meteorological, oceanographic, and climate data, essential for understanding atmospheric conditions, marine environments, and long-term climate trends. | {{< fa brands github >}} [`EpiNOAA-R`](https://github.com/NOAA-Big-Data-Program/EpiNOAA-R) |\n| [Open Traits Network](https://opentraits.org/datasets.html) | While not a repository *per se*, the Open Traits Network has compiled an extensive lists of repositories for trait data. Check out their repository inventory for trait data | -- |\n| [USGS](https://www.usgs.gov/products/data/all-data) | Hosts data on geology, hydrology, biology, and geography, including topographical maps and natural resource assessments. | [`dataRetrieval`](https://cran.r-project.org/web/packages/dataRetrieval/index.html) |\n\n## General Data Searches\n\nIf you don't find what you're looking for in a particular data repository (or want to look for data not included in one of those platforms), you might want to consider a broader search. For instance, [Google](https://www.google.com) is a suprisingly good resource for finding data and--for those familiar with Google Scholar for peer reviewed literature-specific Googling--there is a dataset-specific variant of Google called [Google Dataset Search](https://datasetsearch.research.google.com/).\n\n#### Search Operators\n\nVirtually all search engines support \"operators\" to create more effective queries (i.e., search parameters). If you don't use operators, most systems will just return results that have any of the words in your search which is non-ideal, especially when you're looking for very specific criteria in candidate datasets.\n\nSee the tabs below for some useful operators that might help narrow your dataset search even when using more general platforms.\n\n::: panel-tabset\n#### Quotes\n\nUse quotation marks (`\"\"`) to **search for an exact phrase**. This is particularly useful when you need specific data points or exact wording.\n\nExample: `\"reef biodiversity\"`\n\n#### Wildcard\n\nUse an asterisk (`*`) to **search using a placeholder for any word or phrase in the query**. This is useful for finding variations of a term.\n\nExample: `Pinus * data`\n\n#### Plus\n\nUse a plus sign (`+`) to **search using more than one query *at the same time***. This is useful when you need combinations of criteria to be met.\n\nExample: `bat + cactus`\n\n#### OR\n\nUse the 'or' operator (`OR`) operator to **search for either one term *or* another**. It broadens your search to include multiple terms.\n\nExample: `\"prairie pollinator\" OR \"grassland pollinator\"`\n\n#### Minus\n\nUse a minus sign (`-`; a.k.a. \"hyphen\") to **exclude certain words from your search**. Useful to filter out irrelevant results.\n\nExample: `marine biodiversity data -fishery`\n\n#### Site\n\nUse the site operator (`site:`) to **search within a specific website or domain**. This is helpful when you're looking for data from a particular source.\n\nExample: `site:.gov bird data`\n\n#### File Type\n\nUse the file type operator (`filetype:`) to **search for data with a specific file extension**. Useful to make sure the data you find is already in a format you can intteract with.\n\nExample: `filetype:tif precipitation data`\n\n#### In Title\n\nUse the 'in title' operator (`intitle:`) to **search for pages that have a specific word in the title**. This can narrow down your results to more relevant pages.\n\nExample: `intitle:\"lithology\"`\n\n#### In URL\n\nUse the 'in URL' operator (`inurl:`) to **search for pages that have a specific word in the URL**. This can help locate data repositories or specific datasets.\n\nExample: `inurl:data soil chemistry`\n:::\n\n::: {.callout-note icon=\"false\"}\n## Data Inventory Value\n\nDocumenting potential datasets (and their metadata) thoroughly in a data inventory provides numerous benefits! These include:\n\n- Well-documented datasets make it easier for researchers to find and access specific data for reproducible research\n- Documentation will help researchers to quickly understand the context, scope, and limitations of the data, reducing the time spent on preliminary data assessment\n- Detailed documentation will speed up the data publication process (e.g., data provenance, the difference among methods, etc.)\n- When you need to generate metadata for your own synthesis data product you'll already have much of the information you need\n\n#### Activity: Data Inventory\n\n**Part 1** (\\~25 min)\n\nIn your project groups:\n\n- Review your data inventory Google Sheet and discuss why you chose the datasets included.\n- Decide on a number of datasets equal to the number of group members. Each group member will self-assign one dataset.\n - *Later, each person will download their assigned dataset*\n- Discuss what key information is needed to determine if each dataset is useful for your project.\n- Once you've identified the necessary information, start completing the detailed data inventory Google Sheet (tab separated by project groups).\n - *This sheet will be shared with another group later*\n\n**Part 2** (\\~10 min)\n\n- Swap data inventory tables with another project group.\n- Each group member self-assigns one dataset from the other group’s inventory.\n - *Be sure to choose from the more detailed second sheet!*\n- Try to find the *exact* data file to which you were assigned\n- Do you agree with the information entered in the data inventory?\n- Is there any information you think should be in the data inventory that wasn't?\n:::\n\n::: {.callout-warning icon=\"false\"}\n#### Discussion: Data Inventory\n\nReturn to the main room and let's discuss (some of) the following questions:\n\n- Which elements of the data inventory table made it easier or more difficult to find the data?\n- What challenges did you encounter while searching for the datasets?\n- What is your plan for downloading the data?\n:::\n\n\n## Downloading Data\n\nOnce you've found data, filled out your data inventory, and decided which datasets you actually want, it's time to download some of them! There are several methods you can use and it's possible that each won't work in all cases so it's important to be at least somewhat familiar with several of these tools.\n\nMost of these methods will work regardless of the format of the data (i.e., its file extension) but the format of the data will be important when you want to 'read in' the data and begin to work with it.\n\nBelow are some example code chunks for five methods of downloading data in a scripted way. There will be contexts where only a Graphical User Interface (\"GUI\"; \\[GOO-ee\\]) is available but the details of that method of downloading are usually specific to the portal you're accessing so we won't include an artificial general case.\n\n::: panel-tabset\n### Data Entity URL\n\nSometimes you might have a URL directly to a particular dataset (usually one hosted by a data repository). If you copy/paste this URL into your browser the download would automatically begin. However, we want to make our workflows entirely scripted (or close to it) so see the example below for how to download data via a data entity URL.\n\nThe dataset we download below is one collected at the Santa Barbara Coastal (SBC) LTER on [California spiny lobster (*Panulirus interruptus*) populations](https://portal.edirepository.org/nis/mapbrowse?packageid=knb-lter-sbc.77.10).\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Define URL as an object\ndt_url <- \"https://pasta.lternet.edu/package/data/eml/knb-lter-sbc/77/10/f32823fba432f58f66c06b589b7efac6\" #<1>\n\n# Read it into R\nlobster_df <- read.csv(file = dt_url)\n```\n:::\n\n\n\n\n1. You can typically find this URL in the repository where you found the dataset\n\n### R Package\n\nIf you're quite lucky, the data you want might be stored in a repository that developed (and maintains!) an {{< fa brands r-project >}} R package. These packages may or may not be on CRAN (packages can often also be found on GitHub or Bioconductor). Typically these packages have a \"vignette\" that demonstrates how their functions should be used.\n\nConsider the following example adapted from the USGS `dataRetrieval` [package vignette](https://cran.r-project.org/web/packages/dataRetrieval/vignettes/dataRetrieval.html). Visit [USGS National Water Dashboard interactive map](https://dashboard.waterdata.usgs.gov/app/nwd/en/) to find site numbers and check data availability.\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Load needed packages\n## install.packages(\"librarian\")\nlibrarian::shelf(dataRetrieval)\n\n# Set up the parameters for the Santa Ynez River site\nsiteNumber <- \"11133000\" # USGS site number for Santa Ynez River at Narrows\nparameterCd <- \"00060\" # Parameter code for discharge (cubic feet per second)\nstartDate <- \"2024-01-01\" # Start date\nendDate <- \"2024-01-31\" # End date\n\n# Retrieve daily discharge data\ndischargeData <- readNWISdv(siteNumber, parameterCd, startDate, endDate)\n\n# View the first few rows of the data\nhead(dischargeData)\n```\n:::\n\n\n\n\n### Batch Download\n\nYou may want to download several data files hosted in the same repository online for different spatial/temporal replicates. You *could* try to use the data entity URL or an associated {{< fa brands r-project >}} package (if one exists) or you could write code to do a \"batch download\" where you'd just download each file using a piece of code that repeats itself as much as needed.\n\nThe dataset we demonstrate downloading below is [NOAA weather station data](https://www1.ncdc.noaa.gov/pub/data/gsod/). Specifically it is the Integrated Surface Data (ISD).\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Specify the start/end years for which you want to download data\ntarget_years <- 2000:2005\n\n# Loop across years\nfor(focal_year in target_years){\n\n # Message a progress note\n message(\"Downloading data for \", focal_year) # <1>\n\n # Assemble the URL manually\n focal_url <- paste0( \"https://www1.ncdc.noaa.gov/pub/data/gsod/\", focal_year, \"/gsod_\", focal_year, \".tar\") # <2>\n\n # Assemble your preferred file name once it's downloaded\n focal_file <- paste0(\"gsod_\", focal_year, \".tar\") # <3>\n\n # Download the data\n utils::download.file(url = focal_url, destfile = focal_file, method = \"curl\")\n}\n```\n:::\n\n\n\n\n1. This message isn't required but can be nice! Downloading data can take a *long* time so including a progress message can re-assure you that your R session hasn't crashed\n2. To create a working URL you'll likely need to click an example data file URL and try to *exactly* mimic its format\n3. This step again isn't required but can let you exert a useful level of control over the naming convention of your data file(s)\n\n### API Call\n\nIn slightly more complicated contexts, you'll need to make a request via an Application Programming Interface (\"API\"). As the name might suggest, these platforms serve as a bridge between some application and code. Using such a method to download data is a--relatively--frequent occurrence in synthesis work.\n\nHere we'll demonstrate an API call for NOAA's [Tides and Currents](https://tidesandcurrents.noaa.gov/) data.\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Load needed packages\n## install.packages(\"librarian\")\nlibrarian::shelf(httr, jsonlite)\n\n# Define a 'custom function' to fetch desired data\nfetch_tide <- function(station_id, product = \"predictions\", datum = \"MLLW\", time_zone = \"lst_ldt\", units = \"english\", interval = \"h\", format = \"json\"){ # <1>\n\n # Custom error flags # <2>\n\n # Get a few key dates (relative to today)\n yesterday <- Sys.Date() - 1\n two_days_from_now <- Sys.Date() + 2\n\n # Adjust begin/end dates\n begin_date <- format(yesterday, \"%Y%m%d\")\n end_date <- format(two_days_from_now, \"%Y%m%d\")\n \n # Construct the API URL\n tide_url <- paste0( # <3>\n \"https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?\",\n \"product=\", product,\n \"&application=NOS.COOPS.TAC.WL\",\n \"&begin_date=\", begin_date,\n \"&end_date=\", end_date,\n \"&datum=\", datum,\n \"&station=\", station_id,\n \"&time_zone=\", time_zone,\n \"&units=\", units,\n \"&interval=\", interval,\n \"&format=\", format)\n\n # Make the API request\n response <- httr::GET(url = tide_url)\n \n # If the request is successful...\n if(httr::status_code(response) == 200){\n \n # Parse the JSON response\n tide_data <- jsonlite::fromJSON(httr::content(response, \"text\", encoding = \"UTF-8\"))\n\n # And return it\n return(tide_data)\n\n # Otherwise...\n } else {\n\n # Pass the error message back to the user\n stop(\"Failed to fetch tide data\\nStatus code: \", httr::status_code(response))\n\n }\n}\n\n# Invoke the function\ntide_df <- fetch_tide(station_id = \"9411340\")\n```\n:::\n\n\n\n\n1. When you do need to make an API call, a custom function is a great way of standardizing your entries. This way you only need to figure out how to do the call once and from then on you can lean on the (likely more familiar) syntax of the language in which you wrote the function!\n2. We're excluding error checks for simplicity's sake but **you will want to code informative error checks**. Basically you want to consider inputs to the function that would break it and pre-emptively stop the function (with an informative message) when those malformed inputs are received\n3. Just like the batch download, we need to assemble the URL that the API is expecting\n\n### Command Line\n\nWhile many ecologists are trained in programming languages like R or Python, some operations require the Command Line Interface (\"CLI\"; a.k.a. \"shell\", \"bash\", \"terminal\", etc.). **Don't worry if you're new to this language!** There are a lot of good resources for learning the fundamentals, including The Carpentries' workshop \"[The Unix Shell](https://swcarpentry.github.io/shell-novice/)\".\n\nBelow we demonstrate download via command line for NASA [OMI/Aura Sulfur Dioxide (SO2)](https://disc.gsfc.nasa.gov/datasets/OMSO2e_003/summary?keywords=AURA_OMI_LEVEL3). The OMI science team produces this Level-3 Aura/OMI Global OMSO2e Data Products (0.25 degree Latitude/Longitude grids) for atmospheric analysis.\n\n> Step 1: Using the \"subset/Get Data\" tab on the right-hand side of the [data page](https://disc.gsfc.nasa.gov/datasets/OMSO2e_003/summary?keywords=AURA_OMI_LEVEL3), generate a list of file names for your specified target area and time period. Download the list of links as a TXT file named \"list.txt\". Be sure to document the target area and temporal coverage you selected in your data inventory table.\n\n\n\n\n::: {.cell}\n\n```{.bash .cell-code}\nhttps://acdisc.gesdisc.eosdis.nasa.gov/opendap/HDF-EOS5/ncml/Aura_OMI_Level3/OMSO2e.003/2023/OMI-Aura_L3-OMSO2e_2023m0802_v003-2023m0804t120832.he5.ncml.nc4?ColumnAmountSO2[119:659][0:1439],lat[119:659],lon[0:1439]\nhttps://acdisc.gesdisc.eosdis.nasa.gov/opendap/HDF-EOS5/ncml/Aura_OMI_Level3/OMSO2e.003/2023/OMI-Aura_L3-OMSO2e_2023m0805_v003-2023m0807t093718.he5.ncml.nc4?ColumnAmountSO2[119:659][0:1439],lat[119:659],lon[0:1439]\nhttps://acdisc.gesdisc.eosdis.nasa.gov/opendap/HDF-EOS5/ncml/Aura_OMI_Level3/OMSO2e.003/2023/OMI-Aura_L3-OMSO2e_2023m0806_v003-2023m0809t092629.he5.ncml.nc4?ColumnAmountSO2[119:659][0:1439],lat[119:659],lon[0:1439]\nhttps://acdisc.gesdisc.eosdis.nasa.gov/opendap/HDF-EOS5/ncml/Aura_OMI_Level3/OMSO2e.003/2023/OMI-Aura_L3-OMSO2e_2023m0807_v003-2023m0809t092635.he5.ncml.nc4?ColumnAmountSO2[119:659][0:1439],lat[119:659],lon[0:1439]\nhttps://acdisc.gesdisc.eosdis.nasa.gov/opendap/HDF-EOS5/ncml/Aura_OMI_Level3/OMSO2e.003/2023/OMI-Aura_L3-OMSO2e_2023m0808_v003-2023m0810t092721.he5.ncml.nc4?ColumnAmountSO2[119:659][0:1439],lat[119:659],lon[0:1439]\nhttps://acdisc.gesdisc.eosdis.nasa.gov/opendap/HDF-EOS5/ncml/Aura_OMI_Level3/OMSO2e.003/2023/OMI-Aura_L3-OMSO2e_2023m0809_v003-2023m0811t101920.he5.ncml.nc4?ColumnAmountSO2[119:659][0:1439],lat[119:659],lon[0:1439]\n```\n:::\n\n\n\n\n> Step 2: Open a command line window and execute the wget command. Replace the placeholder for username and password with your EarthData login credentials.\n\n\n\n\n::: {.cell}\n\n```{.bash .cell-code}\nwget -nc --load-cookies ..\\.urs_cookies --save-cookies ..\\.urs_cookies --keep-session-cookies --user=XXX --password=XXX\n--content-disposition -i list.txt\n```\n:::\n\n\n\n\n> If you encounter any issue, follow this step-by-step guide on [using wget and curl specifically with the GES DISC data system](https://disc.gsfc.nasa.gov/information/howto?title=How%20to%20Access%20GES%20DISC%20Data%20Using%20wget%20and%20curl).\n\n:::\n\n::: {.callout-note icon=\"false\"}\n#### Activity: Data Download\n\n\n- Each member work on the data that you have been assigned. \n- Discuss with your group how to collaborate on coding without creating merge conflicts\n - *Many right answers here so discuss the pros/cons of each and pick one that feels best for your group!*\n- Write a script **for your group** to download data using your chosen method\n- Zoom rooms for each download method will be available. You are encouraged to join the room that corresponds to your chosen method to discuss with others working on the same approach. \n - If no datasets in your group's inventory need the download method you chose, try to run the example code included below\n:::\n\n## Data format and structure\n\nCSV and TXT are common formats for data storage. In addition, formats like NetCDF, HDF5, Matlab, and Rdata/RDS are frequently used in research, along with spatial datasets such as geotiff, shapefiles, and raster files (refer to the spatial module for more details).\n\nIn the R environment, data structure are typically checked using the following functions. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(dplyr)\n\n# Define URL as an object\ndt_url <- \"https://pasta.lternet.edu/package/data/eml/knb-lter-sbc/77/10/f32823fba432f58f66c06b589b7efac6\" \n\n# Read it into R\nlobster_df <- read.csv(file = dt_url,na=-99999)\n\n# Check the structure of the data\nhead(lobster_df)\n\nsummary(lobster_df)\n\nstr(lobster_df)\n\nglimpse(lobster_df)\n\nanyNA(lobster_df)\n```\n:::\n\n\n\n\n\n\n## Additional Resources\n\n### Papers & Documents\n\n- British Ecological Society (BES). [Better Science Guides: Data Management Guide](https://www.britishecologicalsociety.org/publications/better-science/). **2024**.\n\n### Workshops & Courses\n\n- LTER Scientific Computing Team. [Data Acquisition Guide for TRY and AppEEARS](https://lter.github.io/scicomp/internal_get-data.html). **2024**.\n- National Center for Ecological Analysis and Synthesis (NCEAS) Learning Hub. [coreR: Data Management Essentials](https://learning.nceas.ucsb.edu/2023-10-coreR/session_14.html). **2023**.\n- NCEAS Learning Hub. [UCSB Faculty Seminar Series: Data Management Essentials and the FAIR & CARE Principles](https://learning.nceas.ucsb.edu/2023-09-ucsb-faculty/session_04.html). **2023**.\n- NCEAS Learning Hub. [UCSB Faculty Seminar Series: Writing Data Management Plans](https://learning.nceas.ucsb.edu/2023-09-ucsb-faculty/session_05.html). **2023**.\n\n### Websites\n\n- Environmental Data Initiative (EDI) [Data Portal](https://portal.edirepository.org/nis/advancedSearch.jsp)\n- DataONE [Data Catalog](https://search.dataone.org/data)\n- Ocean Observatories Initiative (OOI) [Data Explorer](https://dataexplorer.oceanobservatories.org/)\n- Global Biodiversity Information Facility (GBIF) [Data Portal](https://www.gbif.org/)\n- iDigBio Digitized [Specimen Portal](https://www.idigbio.org/portal)\n- [LTAR Data Dashboards and Visualizations](https://ltar.ars.usda.gov/data/data-dashboards/)\n- [LTAR Group Data](https://agdatacommons.nal.usda.gov/Long_Term_Agroecosystem_Research/groups) within the Ag Data Commons, the digital repository of the National Agricultural Library\n- [Data Is Plural](https://www.data-is-plural.com/) and its [data list](https://docs.google.com/spreadsheets/d/1wZhPLMCHKJvwOkP4juclhjFgqIY8fQFMemwKL2c64vk/edit?gid=0#gid=0) for exploring the cool datasets in various domains\n", + "markdown": "---\ntitle: \"Data Discovery & Management\"\ncode-annotations: hover\ncode-overflow: wrap\n---\n\n\n\n## Overview\n\nSynthesis projects often begin with a few datasets that inspire the questions--and end up incorporating dozens or hundreds of others. Researchers may seek out data that resemble their initial datasets, but come from other climates, ecosystems, or cultural settings. Or they may find that they need data of a completely different kind to establish drivers and context. The best synthesizers are resourceful in their search for data, cautious in evaluating data quality and relevance, and meticulous in documenting data sources, treatments, and related analytical decisions. In this workshop, we will cover all these aspects in enough depth for participants to begin finding and assessing their own project data.\n\n## Learning Objectives\n\nAfter completing this module you will be able to:\n\n- Identify repositories \"known for\" a particular type of data\n- Explain how to effectively search for data outside of specialized repositories\n- Create a data inventory for identified data that allows for easy re-finding of those data products\n- Plan how to download data in a reproducible way\n- Perform checks of the fundamental structure of a dataset\n\n## Panel Discussion\n\nTo motivate this module and provide some beneficial context, we're beginning with a conversation with a panel composed of people who work at various organizations with a focus on data management and production. See the tabs below for each year's panelists and links to their professional sites.\n\nPanelists will briefly introduce themselves and describe their roles. They will then speak to the kinds of data available at their organization and the strengths, limitations, and quirks of those data products from a synthesis lens. Individuals not associated with data repositories will instead share their experience working with specific types of data. Time allowing, panelists will talk about their experiences working at their organizations more broadly.\n\n::: panel-tabset\n### 2024 Panelists\n\n- Dr. [Greg Maurer](https://greg.pronghorns.net/index.html), Environmental Data Initiative (EDI) and Jornada LTER\n- Dr. [Eric Sokol](https://www.neonscience.org/person/eric-sokol), Staff Scientist, Quantitative Ecology, National Ecological Observatory Network (NEON)\n- Dr. [Nicole Kaplan](https://www.ars.usda.gov/people-locations/person?person-id=51562), Computational Biologist, U.S. Department of Agriculture-Agricultural Research Service (USDA-ARS)\n- Dr. [Steve Formel](https://www.usgs.gov/staff-profiles/stephen-k-formel), Biologist, USGS Science, Analytics, and Synthesis Program and node manager for the Ocean Biodiversity Information System - USA (OBIS-USA) and the Global Biodiversity Information Facility US (GBIF-US)\n:::\n\n#### Pre-Prepared Questions\n\n- What policies are in place to ensure responsible use of your data?\n- What challenges (technical and scientific) do you see in integrating data across platforms and organizations?\n- Are you aware of any open sources of code useful for downloading, wrangling, or analyzing data in your repository?\n- How can young scientists and data professionals contribute to the work being done by your organizations?\n\n## Data Repositories\n\nThere are *a lot* of specialized data repositories out there. These organizations are either primarily dedicated to storing and managing data or those operations constitute a substantive proportion of their efforts. In synthesis work, you may already have some datasets in-hand at the outset but it likely that **you will need to find more data to test your hypotheses**. Data repositories are a great way of finding/accessing data that are relevant to your questions.\n\nYou'll become familiar with many of these when you need a particular type of data and go searching for it but to help speed you along, see the list below for a non-exhaustive set of some that have proved useful to other synthesis projects in the past. They are in alphabetical order. If the \"{{< fa brands r-project >}} Package\" column contains the GitHub logo ({{< fa brands github >}}) then the package is available on GitHub but is not available on CRAN (or not available at time of writing).\n\n| **Name** | **Description** | {{< fa brands r-project >}} **Package** |\n|:------------------------:|:--------------------|:------------------------:|\n| [AmeriFlux](https://ameriflux.lbl.gov/data/data-policy/) | Provides data on carbon, water, and energy fluxes in ecosystems across the Americas, aiding in climate change and carbon cycle research. | [`amerifluxr`](https://cran.r-project.org/web/packages/amerifluxr/index.html) |\n| [DataONE](https://www.dataone.org/) | Aggregates environmental and ecological data from global sources, focusing on biodiversity, climate, and ecosystem research. | [`dataone`](https://cran.r-project.org/web/packages/dataone/index.html) |\n| [EDI](https://edirepository.org/) | Contains a wide range of ecological and environmental datasets, including long-term observational data, experimental results, and field studies from diverse ecosystems. | [`EDIutils`](https://cran.r-project.org/web/packages/EDIutils/index.html) |\n| [EES-DIVE](https://ess-dive.lbl.gov/) | The Environmental System Science Data Infrastructure for a Virtual Ecosystem (ESS-DIVE) includes a variety of observational, experimental, modeling and other data products from a wide range of ecological and urban systems. | -- |\n| [GBIF](https://www.gbif.org/) | The Global Biodiversity Information Facility (GBIF) aggregates global species occurrence data and biodiversity records, supporting research in species distribution and conservation. | [`rgbif`](https://cran.r-project.org/web/packages/rgbif/index.html) |\n| [Google Earth Engine](https://earthengine.google.com/) | Google Earth Engine is a cloud-based geospatial analysis platform that provides access to vast amounts of satellite imagery and environmental data for monitoring and understanding changes in the Earth's surface. | {{< fa brands github >}} [`rgee`](https://github.com/r-spatial/rgee) |\n| [Microsoft Planetary Computer](https://planetarycomputer.microsoft.com/) | The Microsoft Planetary Computer is a cloud-based platform that combines global environmental datasets with advanced analytical tools to support sustainability and ecological research. | {{< fa brands github >}} [`rstac`](https://github.com/brazil-data-cube/rstac) |\n| [NASA](https://data.nasa.gov/) | Provides data on earth science, space exploration, and climate, including satellite imagery and observational data for both terrestrial and extraterrestrial studies. Nice GUI-based data download via [AppEEARS](https://appeears.earthdatacloud.nasa.gov/). | [`nasadata`](https://cran.r-project.org/web/packages/nasadata/index.html) |\n| [NCBI](https://www.ncbi.nlm.nih.gov/) | Hosts genomic and biological data, including DNA, RNA, and protein sequences, supporting genomics and molecular biology research. | [`rentrez`](https://cran.r-project.org/web/packages/rentrez/index.html) |\n| [NEON](https://data.neonscience.org/) | Provides ecological data from U.S. field sites, covering biodiversity, ecosystems, and environmental changes, supporting large-scale ecological research. | [`neonUtilities`](https://cran.r-project.org/web/packages/neonUtilities/index.html) |\n| [NOAA](https://data.noaa.gov/onestop/) | Offers meteorological, oceanographic, and climate data, essential for understanding atmospheric conditions, marine environments, and long-term climate trends. | {{< fa brands github >}} [`EpiNOAA-R`](https://github.com/NOAA-Big-Data-Program/EpiNOAA-R) |\n| [Open Traits Network](https://opentraits.org/datasets.html) | While not a repository *per se*, the Open Traits Network has compiled an extensive lists of repositories for trait data. Check out their repository inventory for trait data | -- |\n| [USGS](https://www.usgs.gov/products/data/all-data) | Hosts data on geology, hydrology, biology, and geography, including topographical maps and natural resource assessments. | [`dataRetrieval`](https://cran.r-project.org/web/packages/dataRetrieval/index.html) |\n\n## General Data Searches\n\nIf you don't find what you're looking for in a particular data repository (or want to look for data not included in one of those platforms), you might want to consider a broader search. For instance, [Google](https://www.google.com) is a suprisingly good resource for finding data and--for those familiar with Google Scholar for peer reviewed literature-specific Googling--there is a dataset-specific variant of Google called [Google Dataset Search](https://datasetsearch.research.google.com/).\n\n#### Search Operators\n\nVirtually all search engines support \"operators\" to create more effective queries (i.e., search parameters). If you don't use operators, most systems will just return results that have any of the words in your search which is non-ideal, especially when you're looking for very specific criteria in candidate datasets.\n\nSee the tabs below for some useful operators that might help narrow your dataset search even when using more general platforms.\n\n::: panel-tabset\n#### Quotes\n\nUse quotation marks (`\"\"`) to **search for an exact phrase**. This is particularly useful when you need specific data points or exact wording.\n\nExample: `\"reef biodiversity\"`\n\n#### Wildcard\n\nUse an asterisk (`*`) to **search using a placeholder for any word or phrase in the query**. This is useful for finding variations of a term.\n\nExample: `Pinus * data`\n\n#### Plus\n\nUse a plus sign (`+`) to **search using more than one query *at the same time***. This is useful when you need combinations of criteria to be met.\n\nExample: `bat + cactus`\n\n#### OR\n\nUse the 'or' operator (`OR`) operator to **search for either one term *or* another**. It broadens your search to include multiple terms.\n\nExample: `\"prairie pollinator\" OR \"grassland pollinator\"`\n\n#### Minus\n\nUse a minus sign (`-`; a.k.a. \"hyphen\") to **exclude certain words from your search**. Useful to filter out irrelevant results.\n\nExample: `marine biodiversity data -fishery`\n\n#### Site\n\nUse the site operator (`site:`) to **search within a specific website or domain**. This is helpful when you're looking for data from a particular source.\n\nExample: `site:.gov bird data`\n\n#### File Type\n\nUse the file type operator (`filetype:`) to **search for data with a specific file extension**. Useful to make sure the data you find is already in a format you can intteract with.\n\nExample: `filetype:tif precipitation data`\n\n#### In Title\n\nUse the 'in title' operator (`intitle:`) to **search for pages that have a specific word in the title**. This can narrow down your results to more relevant pages.\n\nExample: `intitle:\"lithology\"`\n\n#### In URL\n\nUse the 'in URL' operator (`inurl:`) to **search for pages that have a specific word in the URL**. This can help locate data repositories or specific datasets.\n\nExample: `inurl:data soil chemistry`\n:::\n\n\n## Data Inventory Value\n\nDocumenting potential datasets (and their metadata) thoroughly in a data inventory provides numerous benefits! These include:\n\n- Well-documented datasets make it easier for researchers to find and access specific data for reproducible research\n- Documentation will help researchers to quickly understand the context, scope, and limitations of the data, reducing the time spent on preliminary data assessment\n- Detailed documentation will speed up the data publication process (e.g., data provenance, the difference among methods, etc.)\n- When you need to generate metadata for your own synthesis data product you'll already have much of the information you need\n\n::: {.callout-note icon=\"false\"}\n#### Activity: Data Inventory\n\n**Part 1** (\\~25 min)\n\nIn your project groups:\n\n- Review your data inventory Google Sheet and discuss why you chose the datasets included.\n- Decide on a number of datasets equal to the number of group members. Each group member will self-assign one dataset.\n - *Later, each person will download their assigned dataset*\n- Discuss what key information is needed to determine if each dataset is useful for your project.\n- Once you've identified the necessary information, start completing the detailed data inventory Google Sheet (tab separated by project groups).\n - *This sheet will be shared with another group later*\n\n**Part 2** (\\~10 min)\n\n- Swap data inventory tables with another project group.\n- Each group member self-assigns one dataset from the other group’s inventory.\n - *Be sure to choose from the more detailed second sheet!*\n- Try to find the *exact* data file to which you were assigned\n- Do you agree with the information entered in the data inventory?\n- Is there any information you think should be in the data inventory that wasn't?\n:::\n\n::: {.callout-warning icon=\"false\"}\n#### Discussion: Data Inventory\n\nReturn to the main room and let's discuss (some of) the following questions:\n\n- Which elements of the data inventory table made it easier or more difficult to find the data?\n- What challenges did you encounter while searching for the datasets?\n- What is your plan for downloading the data?\n:::\n\n\n## Downloading Data\n\nOnce you've found data, filled out your data inventory, and decided which datasets you actually want, it's time to download some of them! There are several methods you can use and it's possible that each won't work in all cases so it's important to be at least somewhat familiar with several of these tools.\n\nMost of these methods will work regardless of the format of the data (i.e., its file extension) but the format of the data will be important when you want to 'read in' the data and begin to work with it.\n\nBelow are some example code chunks for five methods of downloading data in a scripted way. There will be contexts where only a Graphical User Interface (\"GUI\"; \\[GOO-ee\\]) is available but the details of that method of downloading are usually specific to the portal you're accessing so we won't include an artificial general case.\n\n::: panel-tabset\n### Data Entity URL\n\nSometimes you might have a URL directly to a particular dataset (usually one hosted by a data repository). If you copy/paste this URL into your browser the download would automatically begin. However, we want to make our workflows entirely scripted (or close to it) so see the example below for how to download data via a data entity URL.\n\nThe dataset we download below is one collected at the Santa Barbara Coastal (SBC) LTER on [California spiny lobster (*Panulirus interruptus*) populations](https://portal.edirepository.org/nis/mapbrowse?packageid=knb-lter-sbc.77.10).\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Define URL as an object\ndt_url <- \"https://pasta.lternet.edu/package/data/eml/knb-lter-sbc/77/10/f32823fba432f58f66c06b589b7efac6\" #<1>\n\n# Read it into R\nlobster_df <- read.csv(file = dt_url)\n```\n:::\n\n\n\n1. You can typically find this URL in the repository where you found the dataset\n\n### R Package\n\nIf you're quite lucky, the data you want might be stored in a repository that developed (and maintains!) an {{< fa brands r-project >}} R package. These packages may or may not be on CRAN (packages can often also be found on GitHub or Bioconductor). Typically these packages have a \"vignette\" that demonstrates how their functions should be used.\n\nConsider the following example adapted from the USGS `dataRetrieval` [package vignette](https://cran.r-project.org/web/packages/dataRetrieval/vignettes/dataRetrieval.html). Visit [USGS National Water Dashboard interactive map](https://dashboard.waterdata.usgs.gov/app/nwd/en/) to find site numbers and check data availability.\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Load needed packages\n## install.packages(\"librarian\")\nlibrarian::shelf(dataRetrieval)\n\n# Set up the parameters for the Santa Ynez River site\nsiteNumber <- \"11133000\" # USGS site number for Santa Ynez River at Narrows\nparameterCd <- \"00060\" # Parameter code for discharge (cubic feet per second)\nstartDate <- \"2024-01-01\" # Start date\nendDate <- \"2024-01-31\" # End date\n\n# Retrieve daily discharge data\ndischargeData <- readNWISdv(siteNumber, parameterCd, startDate, endDate)\n\n# View the first few rows of the data\nhead(dischargeData)\n```\n:::\n\n\n\n### Batch Download\n\nYou may want to download several data files hosted in the same repository online for different spatial/temporal replicates. You *could* try to use the data entity URL or an associated {{< fa brands r-project >}} package (if one exists) or you could write code to do a \"batch download\" where you'd just download each file using a piece of code that repeats itself as much as needed.\n\nThe dataset we demonstrate downloading below is [NOAA weather station data](https://www1.ncdc.noaa.gov/pub/data/gsod/). Specifically it is the Integrated Surface Data (ISD).\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Specify the start/end years for which you want to download data\ntarget_years <- 2000:2005\n\n# Loop across years\nfor(focal_year in target_years){\n\n # Message a progress note\n message(\"Downloading data for \", focal_year) # <1>\n\n # Assemble the URL manually\n focal_url <- paste0( \"https://www1.ncdc.noaa.gov/pub/data/gsod/\", focal_year, \"/gsod_\", focal_year, \".tar\") # <2>\n\n # Assemble your preferred file name once it's downloaded\n focal_file <- paste0(\"gsod_\", focal_year, \".tar\") # <3>\n\n # Download the data\n utils::download.file(url = focal_url, destfile = focal_file, method = \"curl\")\n}\n```\n:::\n\n\n\n1. This message isn't required but can be nice! Downloading data can take a *long* time so including a progress message can re-assure you that your R session hasn't crashed\n2. To create a working URL you'll likely need to click an example data file URL and try to *exactly* mimic its format\n3. This step again isn't required but can let you exert a useful level of control over the naming convention of your data file(s)\n\n### API Call\n\nIn slightly more complicated contexts, you'll need to make a request via an Application Programming Interface (\"API\"). As the name might suggest, these platforms serve as a bridge between some application and code. Using such a method to download data is a--relatively--frequent occurrence in synthesis work.\n\nHere we'll demonstrate an API call for NOAA's [Tides and Currents](https://tidesandcurrents.noaa.gov/) data.\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Load needed packages\n## install.packages(\"librarian\")\nlibrarian::shelf(httr, jsonlite)\n\n# Define a 'custom function' to fetch desired data\nfetch_tide <- function(station_id, product = \"predictions\", datum = \"MLLW\", time_zone = \"lst_ldt\", units = \"english\", interval = \"h\", format = \"json\"){ # <1>\n\n # Custom error flags # <2>\n\n # Get a few key dates (relative to today)\n yesterday <- Sys.Date() - 1\n two_days_from_now <- Sys.Date() + 2\n\n # Adjust begin/end dates\n begin_date <- format(yesterday, \"%Y%m%d\")\n end_date <- format(two_days_from_now, \"%Y%m%d\")\n \n # Construct the API URL\n tide_url <- paste0( # <3>\n \"https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?\",\n \"product=\", product,\n \"&application=NOS.COOPS.TAC.WL\",\n \"&begin_date=\", begin_date,\n \"&end_date=\", end_date,\n \"&datum=\", datum,\n \"&station=\", station_id,\n \"&time_zone=\", time_zone,\n \"&units=\", units,\n \"&interval=\", interval,\n \"&format=\", format)\n\n # Make the API request\n response <- httr::GET(url = tide_url)\n \n # If the request is successful...\n if(httr::status_code(response) == 200){\n \n # Parse the JSON response\n tide_data <- jsonlite::fromJSON(httr::content(response, \"text\", encoding = \"UTF-8\"))\n\n # And return it\n return(tide_data)\n\n # Otherwise...\n } else {\n\n # Pass the error message back to the user\n stop(\"Failed to fetch tide data\\nStatus code: \", httr::status_code(response))\n\n }\n}\n\n# Invoke the function\ntide_df <- fetch_tide(station_id = \"9411340\")\n```\n:::\n\n\n\n1. When you do need to make an API call, a custom function is a great way of standardizing your entries. This way you only need to figure out how to do the call once and from then on you can lean on the (likely more familiar) syntax of the language in which you wrote the function!\n2. We're excluding error checks for simplicity's sake but **you will want to code informative error checks**. Basically you want to consider inputs to the function that would break it and pre-emptively stop the function (with an informative message) when those malformed inputs are received\n3. Just like the batch download, we need to assemble the URL that the API is expecting\n\n### Command Line\n\nWhile many ecologists are trained in programming languages like R or Python, some operations require the Command Line Interface (\"CLI\"; a.k.a. \"shell\", \"bash\", \"terminal\", etc.). **Don't worry if you're new to this language!** There are a lot of good resources for learning the fundamentals, including The Carpentries' workshop \"[The Unix Shell](https://swcarpentry.github.io/shell-novice/)\".\n\nBelow we demonstrate download via command line for NASA [OMI/Aura Sulfur Dioxide (SO2)](https://disc.gsfc.nasa.gov/datasets/OMSO2e_003/summary?keywords=AURA_OMI_LEVEL3). The OMI science team produces this Level-3 Aura/OMI Global OMSO2e Data Products (0.25 degree Latitude/Longitude grids) for atmospheric analysis.\n\n> Step 1: Using the \"subset/Get Data\" tab on the right-hand side of the [data page](https://disc.gsfc.nasa.gov/datasets/OMSO2e_003/summary?keywords=AURA_OMI_LEVEL3), generate a list of file names for your specified target area and time period. Download the list of links as a TXT file named \"list.txt\". Be sure to document the target area and temporal coverage you selected in your data inventory table.\n\n\n\n::: {.cell}\n\n```{.bash .cell-code}\nhttps://acdisc.gesdisc.eosdis.nasa.gov/opendap/HDF-EOS5/ncml/Aura_OMI_Level3/OMSO2e.003/2023/OMI-Aura_L3-OMSO2e_2023m0802_v003-2023m0804t120832.he5.ncml.nc4?ColumnAmountSO2[119:659][0:1439],lat[119:659],lon[0:1439]\nhttps://acdisc.gesdisc.eosdis.nasa.gov/opendap/HDF-EOS5/ncml/Aura_OMI_Level3/OMSO2e.003/2023/OMI-Aura_L3-OMSO2e_2023m0805_v003-2023m0807t093718.he5.ncml.nc4?ColumnAmountSO2[119:659][0:1439],lat[119:659],lon[0:1439]\nhttps://acdisc.gesdisc.eosdis.nasa.gov/opendap/HDF-EOS5/ncml/Aura_OMI_Level3/OMSO2e.003/2023/OMI-Aura_L3-OMSO2e_2023m0806_v003-2023m0809t092629.he5.ncml.nc4?ColumnAmountSO2[119:659][0:1439],lat[119:659],lon[0:1439]\nhttps://acdisc.gesdisc.eosdis.nasa.gov/opendap/HDF-EOS5/ncml/Aura_OMI_Level3/OMSO2e.003/2023/OMI-Aura_L3-OMSO2e_2023m0807_v003-2023m0809t092635.he5.ncml.nc4?ColumnAmountSO2[119:659][0:1439],lat[119:659],lon[0:1439]\nhttps://acdisc.gesdisc.eosdis.nasa.gov/opendap/HDF-EOS5/ncml/Aura_OMI_Level3/OMSO2e.003/2023/OMI-Aura_L3-OMSO2e_2023m0808_v003-2023m0810t092721.he5.ncml.nc4?ColumnAmountSO2[119:659][0:1439],lat[119:659],lon[0:1439]\nhttps://acdisc.gesdisc.eosdis.nasa.gov/opendap/HDF-EOS5/ncml/Aura_OMI_Level3/OMSO2e.003/2023/OMI-Aura_L3-OMSO2e_2023m0809_v003-2023m0811t101920.he5.ncml.nc4?ColumnAmountSO2[119:659][0:1439],lat[119:659],lon[0:1439]\n```\n:::\n\n\n\n> Step 2: Open a command line window and execute the wget command. Replace the placeholder for username and password with your EarthData login credentials.\n\n\n\n::: {.cell}\n\n```{.bash .cell-code}\nwget -nc --load-cookies ..\\.urs_cookies --save-cookies ..\\.urs_cookies --keep-session-cookies --user=XXX --password=XXX\n--content-disposition -i list.txt\n```\n:::\n\n\n\n> If you encounter any issue, follow this step-by-step guide on [using wget and curl specifically with the GES DISC data system](https://disc.gsfc.nasa.gov/information/howto?title=How%20to%20Access%20GES%20DISC%20Data%20Using%20wget%20and%20curl).\n\n:::\n\n::: {.callout-note icon=\"false\"}\n#### Activity: Data Download (~25 mins)\n\n\n- Each member work on the data that you have been assigned. \n- Discuss with your group how to collaborate on coding without creating merge conflicts\n - *Many right answers here so discuss the pros/cons of each and pick one that feels best for your group!*\n- Write a script **for your group** to download data using your chosen method\n- Zoom rooms for each download method will be available. You are encouraged to join the room that corresponds to your chosen method to discuss with others working on the same approach. \n - If no datasets in your group's inventory need the download method you chose, try to run the example codes provided\n:::\n\n## Data format and structure\n\nCSV and TXT are common formats for data storage. In addition, formats like NetCDF, HDF5, Matlab, and Rdata/RDS are frequently used in research, along with spatial datasets such as geotiff, shapefiles, and raster files (refer to the spatial module for more details).\n\nIn the R environment, data structure are typically checked using the following functions. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# Load needed packages\n## install.packages(\"librarian\")\nlibrarian::shelf(tidyverse)\n\n# Define URL as an object\ndt_url <- \"https://pasta.lternet.edu/package/data/eml/knb-lter-sbc/77/10/f32823fba432f58f66c06b589b7efac6\" \n\n# Read it into R\nlobster_df <- read.csv(file = dt_url,na=-99999)\n\n# Check the structure of the data\nhead(lobster_df)\n\nsummary(lobster_df)\n\nstr(lobster_df)\n\nglimpse(lobster_df)\n\nanyNA(lobster_df)\n```\n:::\n\n\n\n\n\n## Additional Resources\n\n### Papers & Documents\n\n- British Ecological Society (BES). [Better Science Guides: Data Management Guide](https://www.britishecologicalsociety.org/publications/better-science/). **2024**.\n\n### Workshops & Courses\n\n- LTER Scientific Computing Team. [Data Acquisition Guide for TRY and AppEEARS](https://lter.github.io/scicomp/internal_get-data.html). **2024**.\n- National Center for Ecological Analysis and Synthesis (NCEAS) Learning Hub. [coreR: Data Management Essentials](https://learning.nceas.ucsb.edu/2023-10-coreR/session_14.html). **2023**.\n- NCEAS Learning Hub. [UCSB Faculty Seminar Series: Data Management Essentials and the FAIR & CARE Principles](https://learning.nceas.ucsb.edu/2023-09-ucsb-faculty/session_04.html). **2023**.\n- NCEAS Learning Hub. [UCSB Faculty Seminar Series: Writing Data Management Plans](https://learning.nceas.ucsb.edu/2023-09-ucsb-faculty/session_05.html). **2023**.\n\n### Websites\n\n- Environmental Data Initiative (EDI) [Data Portal](https://portal.edirepository.org/nis/advancedSearch.jsp)\n- DataONE [Data Catalog](https://search.dataone.org/data)\n- Ocean Observatories Initiative (OOI) [Data Explorer](https://dataexplorer.oceanobservatories.org/)\n- Global Biodiversity Information Facility (GBIF) [Data Portal](https://www.gbif.org/)\n- iDigBio Digitized [Specimen Portal](https://www.idigbio.org/portal)\n- [LTAR Data Dashboards and Visualizations](https://ltar.ars.usda.gov/data/data-dashboards/)\n- [LTAR Group Data](https://agdatacommons.nal.usda.gov/Long_Term_Agroecosystem_Research/groups) within the Ag Data Commons, the digital repository of the National Agricultural Library\n- [Data Is Plural](https://www.data-is-plural.com/) and its [data list](https://docs.google.com/spreadsheets/d/1wZhPLMCHKJvwOkP4juclhjFgqIY8fQFMemwKL2c64vk/edit?gid=0#gid=0) for exploring the cool datasets in various domains\n", "supporting": [], "filters": [ "rmarkdown/pagebreak.lua" diff --git a/mod_data-disc.qmd b/mod_data-disc.qmd index 9a8a85b..b929bd4 100644 --- a/mod_data-disc.qmd +++ b/mod_data-disc.qmd @@ -128,7 +128,7 @@ Use the 'in URL' operator (`inurl:`) to **search for pages that have a specific Example: `inurl:data soil chemistry` ::: -::: {.callout-note icon="false"} + ## Data Inventory Value Documenting potential datasets (and their metadata) thoroughly in a data inventory provides numerous benefits! These include: @@ -138,6 +138,7 @@ Documenting potential datasets (and their metadata) thoroughly in a data invento - Detailed documentation will speed up the data publication process (e.g., data provenance, the difference among methods, etc.) - When you need to generate metadata for your own synthesis data product you'll already have much of the information you need +::: {.callout-note icon="false"} #### Activity: Data Inventory **Part 1** (\~25 min) @@ -358,7 +359,7 @@ wget -nc --load-cookies ..\.urs_cookies --save-cookies ..\.urs_cookies --keep-se ::: ::: {.callout-note icon="false"} -#### Activity: Data Download +#### Activity: Data Download (~25 mins) - Each member work on the data that you have been assigned. @@ -366,7 +367,7 @@ wget -nc --load-cookies ..\.urs_cookies --save-cookies ..\.urs_cookies --keep-se - *Many right answers here so discuss the pros/cons of each and pick one that feels best for your group!* - Write a script **for your group** to download data using your chosen method - Zoom rooms for each download method will be available. You are encouraged to join the room that corresponds to your chosen method to discuss with others working on the same approach. - - If no datasets in your group's inventory need the download method you chose, try to run the example code included below + - If no datasets in your group's inventory need the download method you chose, try to run the example codes provided ::: ## Data format and structure @@ -378,7 +379,9 @@ In the R environment, data structure are typically checked using the following f ```{r data-check} #| eval: false -library(dplyr) +# Load needed packages +## install.packages("librarian") +librarian::shelf(tidyverse) # Define URL as an object dt_url <- "https://pasta.lternet.edu/package/data/eml/knb-lter-sbc/77/10/f32823fba432f58f66c06b589b7efac6"