Neon Path Mac OS

  1. Neon Path Mac Os Download
  2. Neon Path Mac Os X
  3. Mac Os Versions
  4. Neon Path Mac Os Download

The primary goal of this tutorial is to explain how to set a working directory in R. The working directory is where your R session interacts with your hard drive. This is where you can read data that you want to use, and save new information such as derived data products, tables, maps, and figures. It is a good practice to store your information in an organized set of directories, so you will often want to change your working directory depending on what kinds of information that you need to access.This tutorial teaches how to download and unzip the data files that accompany many NEON Data Skills tutorials, and also covers the concept of file paths. You can read from top to bottom, or use the menu bar at left to navigate to your desired topic.

Learning Objectives

(note: I have made no modifications system paths, so these are the defaults set by the OS or perhaps by one or more of the applications i've installed.) Best Answer For those of you looking for an answer years later (Neon, Oxygen). Palmer's GUI information is correct, but there is a more maintainable way to modify the path seen by the shell. Like mediaslave said, you can edit /etc/paths, but even better you can drop a text file in /etc/paths.d/ that has a path in it and all shells will construct the path correctly. For example, on my system: $ cat /etc/paths /usr/bin /bin /usr/sbin /sbin /usr/local/bin $ ls /etc/paths.d. Source: National Ecological Observatory Network (NEON) Mac Operating Systems: Go to the Misc menu, select Change Working Directory, in the new window that appears, select the appropriate directory. How to set the working directory using the R GUI in Mac OS X. Source: National Ecological Observatory Network (NEON). Steinberg is known the world over for its audio software and hardware solutions. The company has been developing, manufacturing and selling innovative products for musicians and producers in the music, film, post production, and multimedia industries since 1984. Steinberg products are used by Grammy® and Oscar® award winning composers, engineers, and producers. The company also offers.

After completing this tutorial, you will be able to:

  • Be able to download and uncompress NEON Teaching Data Subsets.
  • Be able to set the R working directory.
  • Know the difference between full, base and relative paths.
  • Be able to write out both full and relative paths for a given file ordirectory.

Things You’ll Need To Complete This Lesson

To complete this lesson you will need the most current version of R and, preferably, RStudio loaded on your computer.

Download Data

NEON Teaching Data Subset: Meteorological Data for Harvard Forest

The data used in this lesson were collected at the National Ecological Observatory Network's Harvard Forest field site. These data are proxy data for what will be available for 30 years on the NEON data portalfor the Harvard Forest and other field sites located across the United States.

NEON Teaching Data Subset: Site Layout Shapefiles

These vector data provide information on the site characterization and infrastructure at the National Ecological Observatory Network's Harvard Forest field site.The Harvard Forest shapefiles are from the Harvard Forest GIS & Map archives. US Country and State Boundary layers are from the US Census Bureau.

Set Up For NEON Data Skills Tutorials

Many NEON data tutorials utilize teaching data subsets which are hosted on the NEON Data Skills figshare repository. If a data subset is required for a tutorial it can be downloaded at the top of each tutorial in the Download Data section.

Prior to working with any data in R, we must set the working directory tothe location of the data files. Setting the working directory tells R where the data files are located on the computer. If the working directory is not correctly set first, when we try to open a file we will get an error telling us that R cannot find the file.

Data Tip: All NEON Data Skills tutorials arewritten assuming the working directory is the parent directory to the uncompressed .zip file of downloaded data. This allows for multiple data subsets to be accessed in the tutorial without resetting the working directory. Generally, these tutorials have a default working directory of ~/Documents/data. If you are working on a Mac, we suggest that you save your downloaded datasets in a directory with the same name and location so that you don't have to edit the code for the tutorial that you are working on. Most windows machines cannot use the tilde '~' notation, therefore you must define the working directory explicitly.

  • Wondering why we're saying directory instead of folder? See ourdiscussion of Directory vs. Folder in the middle of this tutorial.

Download & Uncompress the Data

1) Download

First, we will download the data to a location on the computer. To download the data for this tutorial, click the blue button Download NEON Teaching Data Subset: Meteorological Data for Harvard Forest within the box at the top of this page.

Note: In other NEON Data Skills tutorials, download all data subsets in theDownload Data section prior to starting the tutorial. Here, the seconddata subset is for those wishing to practice these skills in a Challenge activity and will be downloaded at that time.

After clicking on the Download Data button, the data will automatically download to the computer.

2) Locate .zip file

Second, we need to find the downloaded .zip file. Many browsers default to downloading to the Downloads directory on your computer. Note: You may have previously specified a specific directory (folder) for filesdownloaded from the internet, if so, the .zip file will download there.

3) Move to data directory

Third, we must move the data files to the location we want to work with them. We recommend moving the .zip to a dedicated data directory within theDocuments directory on your computer. This data directory can then be a repository for all data subsets you use for the NEON Data Skills tutorials. Note: If you chose to store your data in a different directory (e.g., not in ~/Documents/data), modify the directions below with the appropriate file path to your data directory.

4) Unzip/uncompress

Fourth, we need to unzip/uncompress the file so that the data files can be accessed. Use your favorite tool that can unpackage/open .zip files (e.g.,winzip, Archive Utility, etc). The files will now be accessible in a directory named NEON-DS-Met-Time-Series containing all the subdirectories and files that make up the dataset or the subdirectories and files will be unzipped directly into the data directory. If the latter happens, they need to be moved into a data/NEON-DS-Met-Time-Series directory.

Challenge: Download and Unzip Teaching Data Subset

Want to make sure you have these steps down! Prepare the Site Layout Shapefiles Teaching Data Subset so that the filesare accessible and ready to be opened in R.

The directory should be the same as in this screenshot (below). Note that NEON-DS-Site-Lyout-Files directory will only be in your directory if you completed the challenge above. If you did not, your directory should look the same but without that directory.

Directory vs. Folder

'Directory' and 'Folder' both refer to the same thing. Folder makes a lot of sense when we think of an isolated folder as a 'bin' containing many files. However, the analogy to a physical file folder falters when we start thinking about the relationship between different folders and how we tell a computer to find a specific folder. This is why the term directory is often preferred. Any directory (folder) can hold other directories and/or files. When we set the working directory, we are telling the computer the location of the directory (or folder) to start with when looking for other files or directories, or to save any output to.

Full, Base, and Relative Paths

The data downloaded and unzipped in the previous steps are located within a nested set of directories:

  • primary-level/home directory: neon
    • This directory isn't obvious as we are within this directory once we loginto the computer.
    • You will see your own user ID.
  • secondary-level directory: neon/Documents
  • tertiary-level directory: neon/Documents/data
  • quaternary-level directory: neon/Documents/data/NEON-DS-Met-Time-Series
  • quaternary-level directory: neon/Documents/data/NEON-DS-Site-Layout-Shapefiles

Full & Base Path

The full path is essentially the complete 'directions' for how to find the desired directory or file. It always starts with the home directory or root(e.g., /Users/neon/). A full path is the base path when used to set the working directory to a specific directory. The base path for the NEON-DS-Met-Time-Series directory would be:

Data Tip: File or directory paths and the home directory will appear slightly different in different operating systems. Linux will appear as /home/neon/. Windows will be similar to C:Documents and Settingsneon or C:Usersneon. The format varies by Windows version. Make special note of the direction of the slashes. Mac OS X and Unix format will appear as /Users/neon/. This tutorial will show Mac OS X output unless specificallynoted.

Challenge: Full File Path

Write out the full path for the NEON-DS-Site-Layout-Shapefiles directory. Usethe format of the operating system you are currently using.

Tip: When typing in the Rstudio console or an R script, if you surround your filepath with quotes you can take advantage of the 'tab-completion' feature. To use this feature, begin typing your filepath (e.g., '~/' or 'C:') and then hit the tab button, which should pop up a list of possible directories and files that you could be pointing to. This method is awesome for avoiding typos in complex or long filepaths!

Bonus Points: Write the path as for one of the other operating systems.

Relative Path

A relative path is a path to a directory or file that starts from thelocation determined by the working directory. If our working directory is setto the data directory,

we can then create a relative path for all directories and files within thedata directory.

The relative path for the meanNDVI_HARV_2011.csv file would be:

Challenge: Relative File Path

Use the format of your current operating system:

  1. Write out the full path to for the Boundary-US-State-Mass.shp file.
  2. Write out the relative path for the Boundary-US-State-Mass.shp fileassuming that the working directory is set to /Users/neon/Documents/data/.

Bonus: Write the paths as for one of the other operating systems.

The R Working Directory

In R, the working directory is the directory where R starts when looking for any file to open (as directed by a file path) and where it saves any output.

Without a working directory all R scripts would need the full file path written any time we wanted to open or save a file. It is more efficient if we have a base file path set as our working directory and then all file paths written in our scripts only consist of the file path relative to that base path (a relative path).

  • If you are unfamiliar with the term full path, base path, or relative path, please see the section below on Full, Base, and Relative Pathsfor a more detailed explanation before continuing with this tutorial.

Find a Full Path to a File in Unknown Location

If you are unsure of the path to a specific directory or file, you can find this information for a particular file/directory of interest by looking in the:

  • Windows: Properties, General tab (right click on the file/directory) or in the file path bar at the top of each window (select versions).
  • Mac OS X: Get Info (right clicking/control+click on the file/directory)

The file path may appear as:

Computer > Users > neon > Documents > data > NEON-DS-Met-Time-Series

Copy and paste this information to automatically reformat into the full path to the directory or file:

  • Windows: C:UsersneonDocumentsdataNEON-DS-Met-Time-Series
  • Mac OS X: /Users/neon/Documents/data/NEON-DS-Met-Time-Series

Data Tip: File or directory paths and the home directory will appear slightly different in different operating systems. Linux will appear as /home/neon/. Windows will be similar to C:Documents and Settingsneon or C:Usersneon. The format varies by Windows version. Make special note of the direction of the slashes. Mac OS X and Unix format will appear as /Users/neon/. This tutorial will show Mac OSX output unless specificallynoted.

Determine Current Working Directory

Once we are in the R program, we can view the current working directoryusing the code getwd().

The working directory is currently set to the home directory /Users/neon. Remember, your current working directory will have a different user name and mayappear different based on operating system.

This code can be used at any time to determine the current working directory.

Set the Working Directory

To set our current working directory to the location where our data are located,we can either set the working directory in the R script or use our current GUIto select the working directory.

Data Tip: All NEON Data Skills tutorials arewritten assuming the working directory is the parent directory to the downloadeddata (the data directory in this tutorial). This allows for multiple data subsets to be accessed in the tutorial without resetting the working directory.

We want to set our working directory to the data directory.

Set the Working Directory: Base Path in Script

We can set the working directory using the code setwd('PATH') where PATH is the full path to the desired directory. You can enter 'PATH' as a string (as shown below), or save the file path as a string to a variable (e.g., wd <- '~/Documents/data') and then set the working directory based on that variable (e.g., setwd(wd)).

This latter method is used in many of the NEON Data Skills tutorials because of the advantages that this method provides. First, this method is extermely flexible across different compute environments and formats, including personal computers, Linux-based servers on 'the cloud' (e.g., AWS, CyVerse), and when using Rmarkdown (.Rmd) documents. Second this method allows the tutorial's user to set their working directory once as a string and then to reuse that string as needed to reference input files, or make output files. For example, some functions must have a full filepath to an input file (such as when reading in HDF5 files). Third, this method simplifies the process that NEON uses internally to create and update these tutorials. All in all, saving the working directory as a string variable makes the code more explicit and determanistic without relying on working knowledge of relative filepaths, making your code more producible and easier for an outsider to interpret.

To practice, use these techniques to set your working directory to the directory where you have the data saved, and check that you set the working directory correctly. There is no R output from setwd(). If we want to check that the working directory is correctly set we can use getwd().

Example Windows File Path

Notice the the backslashes used in Windows paths must be changed to slashes inR.

Example Mac OS X File Path

Data Tip: If using RStudio, you can view the contents of the working directory in the Files pane.

Set the Working Directory: Using RStudio GUI

You can also set the working directory using the Rstudio and/or R graphical user interface (GUI). This method is easy for beginners to learn, but it also makes your code less reproducible because it relies on a person to follow certain instructions, which is a process that introduces human error. It may also be impossible for an observer to determine where your input data are stored, which can make troubleshooting more difficult as well. Use this method when getting started, or when you will find it helpful to use a graphical user interface to navigate your files. Note that this method will run a single line setwd() command in the console when you select your working directory, so you can copy/paste that line into your script for future use!

  1. Go to Session in menu bar,
  2. select Select Working Directory,
  3. select Choose Directory,
  4. in the new window that appears, select the appropriate directory.

Set the Working Directory: Using R GUI

Windows Operating Systems:

  1. Go to the File menu bar,
  2. select Change dir... or Change Working Directory,
  3. in the new window that appears, select the appropriate directory.

Mac Operating Systems:

  1. Go to the Misc menu,
  2. select Change Working Directory,
  3. in the new window that appears, select the appropriate directory.

This page outlines the tools and resources that you will need to install Git, Bash and Python applications onto your computer as the first step of our Python skills tutorial series.

Checklist

Detailed directions to accomplish each objective are below.

  • Install Bash shell (or shell of preference)
  • Install Git
  • Install Python 3.x

Bash/Shell Setup

Install Bash for Windows

  1. Download the Git for Windows installer.
  2. Run the installer and follow the steps bellow:
    1. Welcome to the Git Setup Wizard: Click on 'Next'.
    2. Information: Click on 'Next'.
    3. Select Destination Location: Click on 'Next'.
    4. Select Components: Click on 'Next'.
    5. Select Start Menu Folder: Click on 'Next'.
    6. Adjusting your PATH environment: Select 'Use Git from the Windows Command Prompt' and click on 'Next'. If you forgot to do this programs that you need for the event will not work properly. If this happens rerun the installer and select the appropriate option.
    7. Configuring the line ending conversions: Click on 'Next'. Keep 'Checkout Windows-style, commit Unix-style line endings' selected.
    8. Configuring the terminal emulator to use with Git Bash: Select 'Use Windows' default console window' and click on 'Next'.
    9. Configuring experimental performance tweaks: Click on 'Next'.
    10. Completing the Git Setup Wizard: Click on 'Finish'.

This will provide you with both Git and Bash in the Git Bash program.

Install Bash for Mac OS X

The default shell in all versions of Mac OS X is bash, so noneed to install anything. You access bash from the Terminal(found in/Applications/Utilities). You may want to keepTerminal in your dock for this workshop.

Install Bash for Linux

The default shell is usually Bash, but if yourmachine is set up differently you can run it by opening aterminal and typing bash. There is no need toinstall anything.

Git Setup

Git is a version control system that lets you track who made changes to whatwhen and has options for easily updating a shared or public version of your codeon GitHub. You will need asupportedweb browser (current versions of Chrome, Firefox or Safari, or Internet Explorerversion 9 or above).

Git installation instructions borrowed and modified from Software Carpentry.

Neon Path Mac Os Download

Git for Windows

Git should be installed on your computer as part of your Bash install.

Git on Mac OS X

Install Git on Macs by downloading and running the most recent installer for'mavericks' if you are using OS X 10.9 and higher -or- if using anearlier OS X, choose the most recent 'snow leopard' installer, fromthis list.After installing Git, there will not be anything in your/Applications folder, as Git is a command line program.

Data Tip:If you are running Mac OSX El Capitan, you might encounter errors when trying touse git. Make sure you update XCODE. Read more - a Stack Overflow Issue.

Git on Linux

If Git is not already available on your machine you can try toinstall it via your distro's package manager. For Debian/Ubuntu runsudo apt-get install git and for Fedora runsudo yum install git.

Setting Up Python

Python is a popular language forscientific computing and data science, as well as being a great for general-purpose programming. Installing all of the scientific packages individually can be a bit difficult, so we recommend using an all-in-one installer, like Anaconda.

Regardless of how you choose to install it, **please make sure your environment is set up with Python version 3.7 (at the time of writing, the gdal package did not work with the newest Python version 3.6). Python 2.x is quite different from Python 3.xso you do need to install 3.x and set up with the 3.7 environment.

We will teach using Python in the Jupyter Notebook environment, a programming environment that runs in a web browser. For this to work you will need a reasonably up-to-date browser. The current versions of the Chrome, Safari and Firefox browsers are all supported(some older browsers, including Internet Explorer version 9 and below, are not).You can choose to not use notebooks in the course, however, we do recommend you download and install the library so that you can explore this tool.

Windows

Download and install Anaconda.Download the default Python 3 installer (3.7). Use all of the defaults for installation except make sure to check Make Anaconda the default Python.

Mac OS X

Download and install Anaconda.Download the Python 3.x installer, choosing either the graphical installer or the command-line installer (3.7). For the graphical installer, use all of the defaults for installation. For the command-line installer open Terminal, navigate to thedirectory with the download then enter:

Mac os download

bash Anaconda3-2020.11-MacOSX-x86_64.sh (or whatever you file name is)

Linux

Download and install Anaconda.Download the installer that matches your operating system and save it in your home folder. Download the default Python 3 installer.

Neon Path Mac Os X

Open a terminal window and navigate to your downloads folder. Type

Mac Os Versions

bash Anaconda3-2020.11-Linux-ppc64le.sh

and then press tab. The name of the file you just downloaded should appear.

Press enter. You will follow the text-only prompts. When there is a colon at the bottom of the screen press the down arrow to move down through the text. Type yes and press enter to approve the license. Press enter to approve the default location for the files. Type yes and press enter to prepend Anaconda to your PATH (this makes the Anaconda distribution the default Python).

Install Python packages

We need to install several packages to the Python environment to be able to workwith the remote sensing data

  • gdal
  • h5py

If you are new to working with command line you may wish to complete the nextsetup instructions which provides and intro to command line (bash) prior to completing these package installation instructions.

Neon Path Mac Os Download

Windows

Create a new Python 3.7 environment by opening Windows Command Prompt and typing

conda create –n py37 python=3.7 anaconda

When prompted, activate the py37 environment in Command Prompt by typing

activate py37

You should see (py37) at the beginning of the command line. You can also test that you are using the correct version by typing python --version.

Install Python package(s):

  • gdal: conda install gdal
  • h5py: conda install h5py

Note: You may need to only install gdal as the others may be included in the default.

Mac OS X

Create a new Python 3.7 environment by opening Terminal and typing

conda create –n py37 python=3.7 anaconda

This may take a minute or two.

When prompted, activate the py37 environment in Command Prompt by typing

source activate py37

You should see (py37) at the beginning of the command line. You can also test that you are using the correct version by typing python --version.

Install Python package(s):

  • gdal: conda install gdal
  • h5py: conda install h5py

Linux

Open default terminal application(on Ubuntu that will be gnome-terminal).

Launch Python.

Install Python package(s):

  • gdal: conda install gdal
  • h5py: conda install h5py

Set up Jupyter Notebook Environment

In your terminal application, navigate to the directory (cd) that where youwant the Jupyter Notebooks to be saved (or where they already exist).

Open Jupyter Notebook with

jupyter notebook

Once the notebook is open, check which version of Python you are in by using the prompts

You should now be able to work in the notebook.

The gdal package that occasionally has problems with some versions of Python. Therefore test out loading it using

import gdal.

Additional Resources