%GCL
// Milankovitch cycles: first test pgm
// Created 2005-12-25, last edit 2005-12-26
// (c) Erik De Sonville, http://users.skynet.be/erik.desonville/
// Initialize variables
stat = 0
n = 1001
x = falloc(n)
y01 = falloc(n)
y07 = falloc(n)
kyear = 0.
insol = 0.
// Open files
nu01=fopen('.\data\insola.01.asc','r')
if (nu01==-1) goto e001
nu07=fopen('.\data\insola.07.asc','r')
if (nu07==-1) goto e001
// Read data into arrays
do i=0,1000
x[i] = (i-34000.)
stat = fscanf(nu01,'%f',kyear)
if (stat==-1) goto e002
stat = fscanf(nu01,'%f',insol)
if (stat==-1) goto e002
y01[i] = insol
stat = fscanf(nu07,'%f',kyear)
if (stat==-1) goto e002
stat = fscanf(nu07,'%f',insol)
if (stat==-1) goto e002
y07[i] = insol
end do
stat = fclose(nu01)
stat = fclose(nu07)
// Make graph
METAFL ('CONS')
DISINI ()
HWFONT ()
PAGERA ()
AXSPOS (300,320+1200)
AXSLEN (2000,1200)
NAME ('Time (kYr)', 'X')
NAME ('Insolation', 'Y')
TITLIN ('La2004 INSOLATION AT 51 DEG N', 1)
titlin ('(White: first months of Winter, Dec 21st - Jan 21st)',2)
titlin ('(Red: first months of Summer, Jun 21st - Jul 21st)',3)
TICKS (4, 'X')
LABDIG (-1, 'X')
GRAF (-34000.,-33000.,-34000.,200.,0.,1000.,0.,100.)
TITLE ()
COLOR ('white')
CURVE (x,y01,n)
COLOR ('red')
CURVE (x,y07,n)
IMGCLP (0,0,820,600)
FILMOD ('DELETE')
RPNG ('.\milan.png')
DISFIN ()
goto done
e000:
printf('e000')
goto done
e001:
printf('e001')
goto done
e002:
printf('e002')
goto done
done: