Instructions for Windows Users

You can run all the code at this blog on Windows, rather than Linux. I will show you how. Preferred Windows is version 10. That’s the only one I’ve set up. Any Windows >7.0 should work in theory.


Run Windows Command Line (<Win>+R; type “cmd” then <enter>)

cd \
mkdir Zoe

Zoe is your variable. Make it whatever you want, remember it, then “exit” <enter>


Download Cygwin Setup Program. [Direct Link to 64-bit Exe]

Run Exe, click <Next>

Choose 1st
Set the root directory
Set to same previous directory
Choose a connection method, I choose 1st
Choose a mirror
Change View to “Full”

You will need 3 packages: wget, lua (5.3), gnuplot.

Type package name in search, then under New, CLICK on the word “Skip”, version number will appear

For lua, keep clicking “Skip/Version #” until version 5.3.x appears. Failure to do so will break gnuplot.

When done click <Next>. Next screen suggests dependencies; Just click <Next>, then wait through download & install process.

First is required, 2nd is your choice

Download Miniconda3. [Direct Link to 64-bit Exe]. Run Exe, click <Next>, click <I Agree>

Your choice. I do recommended.
Place it inside previous Cygwin directory for neatness
I select both. Caution if you are a python developer.

When complete, click <Next>, click <Next>, deselect both “Learn …”, click <Finish>

Double click

A new user home environment will be created.

The Path is “C:\Zoe\home\<Windows Username>”. All code can just go here.

Inside the Terminal:

$ conda config --add channels conda-forge
$ conda install nco numpy

Second command requires your confirmation. Type “y” and <enter>.

When done, exit with “exit” <enter>, and relaunch Cygwin Terminal.


Use any text editor you like (must be able to format Unix-style files), or get Sublime. [Direct Link to 64-bit Exe]

After install, run, and select: File > New File

Make sure to set View > Line Endings > Unix, otherwise script will not run!

Copy and paste the following sample code into the empty new file:

# source map.sh

download() {
	wget -c ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis/surface/land.nc
}

extract() {
	ncks --trd -HC land.nc | awk -F [=\ ] '{
		if ($6 < 191) {$6+=169} else {$6-=191}
		print $6" "$4" "$8
	}' > map.dat
}

plot() {
	echo 'set term png size 362,182; set nokey
		set yrange [-90:90]; set xrange [0:360]
		set noborder; unset colorbox 
		unset xtics; unset ytics
		set palette define (0 "blue", 1 "orange") 
		set margin 0,0,0,0
		plot "map.dat" u 1:2:3 pt 5 ps 1 lc palette' | gnuplot > map.png
}

Save this file to: C:\Zoe\home\<Windows Username>\map.sh

Now execute from Cygwin Terminal:

$ source map.sh
$ download
$ extract
$ plot

* or *

$ . map.sh && download && extract && plot

The result is a file called map.png inside C:\Zoe\home\<Windows Username>. Use Windows Explorer to find it and launch it.

If map.png looks like this … you are done! Most of my blog code will work.


Happy Coding 🙂 -Zoe

Published by Zoe Phin

https://phzoe.com

11 thoughts on “Instructions for Windows Users

  1. Thanks for this Zoe,

    This way is going to be a lot less work for Windos Users than adding a virtual machine with appropriate linux guest OS and the packages — and then learning how that all works, or not. The instructions are clear, precise, and include a fair test to check that it’s all working as expected. Some may have a few hiccups, like with anti-virus or firewall setitngs but those are easily overcome by following the directions for their particular system and softwares.

    On this Win7 64bit system, it took less than the time to drink my morning coffee. One of the best parts of adding miniconda is that it came with Python, a language very well suited to doing much work on large data sets with few lines of code.

    Now on to playing with some of your other scripts, as well as doing some tide guage plots to put them inlanders at ease about the supposed “exponential catastophic” sea-level rise.

    Liked by 1 person

  2. Thanks to that wonderful philanthropist and fellow Scot, Andrew Carnegie who funded the creation of over 3,000 public libraries throughout the world, almost every town and city in Scotland has a Carnegie library. As a child, I helped fund my local one with late return fees.

    Liked by 1 person

  3. Zoe,
    Recently discovered your website, love it. Appeals to the me that loved physical chemistry and physics theories during my chemistry degree.

    anyway, Windows 10 also allows you to run linux much more natively than Cygwin (cygwin is good but…), and you have a choice of a few distros (ubuntu, SuSE and a few more)

    details here:-

    https://docs.microsoft.com/en-us/windows/wsl/install-win10

    Before installing Ubuntu/SuSE on Windows, please open the Control Panel, visit Programs and Features’ submenu Turn Windows features on or off and select Windows Subsystem for Linux. Click OK, reboot, and then your system is ready to run (search for ubuntu in windows store)

    Instead of the above steps You can set up your system by executing the following command in the Administrator PowerShell prompt:

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

    When your system is ready simply start “ubuntu” in cmd.exe or launch Ubuntu from the start menu.

    hope that helps a few!

    Liked by 1 person

Leave a comment

Design a site like this with WordPress.com
Get started