Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)
edited by

So I am not experienced in dealing with the plethora of file types, and I haven't been able to find much info on exactly what the .sh files are. Here's what I am trying to do:

I wanted to download map data sets which are arranged in tiles that can be downloaded individually:

http://daymet.ornl.gov/gridded

To download the range of tiles at once, they say to download their script, which eventually leads to the daymet-nc-retrieval.sh: 

https://github.com/daymet/scripts/blob/master/Bash/daymet-nc-retrieval.sh

So, what exactly am I supposed to do with the code? The website doesn't provide any further instructions, assuming users know what to do with it. I am guessing the supposed to paste this code into some other unmentioned application for the browser (using Chrome or Firefox in this case)? It almost looks like something that could be pasted into the Firefox/Greasemonkey, but not quite. Just by the quick Google on the file type, I haven't been able to get heads or tails on it.

I am sure there is a simple explanation on what to do with these files out there, but it seems to be buried in plenty of posts where people are already assuming that you know what to do with the files. Is anyone willing to just simply say what needs to be done from square one after getting to this page with the code to implementing it? Thanks.

1 Answer

0 votes
by (36.8k points)

If you open your second link in the browser you'll see a source code:

#!/bin/bash

# Script to download individual .nc files from the ORNL

# Daymet server at: http://daymet.ornl.gov

[...]

# For ranges use {start..end}

# for individul vaules, use: 1 2 3 4 

for year in {2002..2003}

do

   for tile in {1159..1160}

        do wget --limit-rate=3m http://daymet.ornl.gov/thredds/fileServer/allcf/${year}/${tile}_${year}/vp.nc -O ${tile}_${year}_vp.nc

        # An example using curl instead of wget

    #do curl --limit-rate 3M -o ${tile}_${year}_vp.nc http://daymet.ornl.gov/thredds/fileServer/allcf/${year}/${tile}_${year}/vp.nc

     done

done

So it's a bash script. Got Linux?

Want to be a Linux expert? Come and join this linux course

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...