mcglinnlab / shark-ray-div

Global patterns of shark and ray diversity
0 stars 1 forks source link

Importing environmental variables #9

Closed dmcglinn closed 7 years ago

dmcglinn commented 7 years ago

From Emmaline

I found temperature data here: https://www.nodc.noaa.gov/cgi-bin/OC5/woa13/woa13.pl and I found chlorophyll data here: https://www.nodc.noaa.gov/OC5/WOA01/1d_woa01.html the issue though is, while I know I downloaded temperature at least as a shape file, they download in the .gz format, and I'm having a bit of difficulty reading that into R in the format I want. the gzfile function seems to successfully open it, but I haven't been able to read it in as a shapefile after that

dmcglinn commented 7 years ago

Have you tried just reading it directly with readOGR? Sometimes that works well. Otherwise I suggest putting the file on the server and using the following command from the terminal unzip myfile.gz where myfile.gz is the name of the file you are trying to unzip.

EmmalineSheahan commented 7 years ago

So if I try unzip in the terminal, it says that it can't find or open the file, and if I try the unzip function in the console it says error 1 in extracting from zip file. readOGR also doesn't work when I use the usual shapefile format readOGR(dsn = "./data", layer = "myfile") . There might be a way to make it work with gz, I just don't know how to format it for that and ?readOGR didn't mention gz

EmmalineSheahan commented 7 years ago

I figured it out, I had to use untar('./data/polygon/temperature.gz', compressed = "gzip") and it extracts it to the directory

dmcglinn commented 7 years ago

nice!

On Fri, Aug 4, 2017 at 3:14 PM, EmmalineSheahan notifications@github.com wrote:

I figured it out, I had to use untar('./data/polygon/temperature.gz', compressed = "gzip") and it extracts it to the directory

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mcglinnlab/shark-ray-div/issues/9#issuecomment-320331318, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIp7Y7zmv0pVWFHuQMpRl4kUqyuaaHsks5sU22ZgaJpZM4OuB-e .

-- Daniel J. McGlinn, PhD Assistant Professor College of Charleston Department of Biology Harbor Walk West, rm 203 360 Concord Street Charleston, SC 29401 http://mcglinn.web.unc.edu/ office: 843-953-0190 cell: 405-612-1780