head	8.7;
access;
symbols;
locks; strict;
comment	@ * @;


8.7
date	2026.05.11.12.01.11;	author mcalabre;	state Exp;
branches;
next	8.6;

8.6
date	2026.03.29.13.53.57;	author mcalabre;	state Exp;
branches
	8.6.1.1;
next	8.5;

8.5
date	2025.12.06.13.47.42;	author mcalabre;	state Exp;
branches
	8.5.1.1;
next	8.4;

8.4
date	2024.10.28.13.56.18;	author mcalabre;	state Exp;
branches
	8.4.1.1;
next	8.3;

8.3
date	2024.05.13.16.33.01;	author mcalabre;	state Exp;
branches
	8.3.1.1;
next	8.2;

8.2
date	2023.11.16.10.00.31;	author mcalabre;	state Exp;
branches
	8.2.1.1;
next	8.1;

8.1
date	2023.07.05.17.12.07;	author mcalabre;	state Exp;
branches
	8.1.1.1;
next	8.0;

8.0
date	2023.07.01.06.15.05;	author mcalabre;	state Exp;
branches
	8.0.1.1;
next	7.13;

7.13
date	2022.10.07.03.43.35;	author mcalabre;	state Exp;
branches
	7.13.1.1;
next	7.12;

7.12
date	2022.09.09.04.57.58;	author mcalabre;	state Exp;
branches
	7.12.1.1;
next	7.11;

7.11
date	2022.04.26.06.13.52;	author mcalabre;	state Exp;
branches
	7.11.1.1;
next	7.10;

7.10
date	2022.04.23.14.25.15;	author mcalabre;	state Exp;
branches
	7.10.1.1;
next	7.9;

7.9
date	2022.03.25.15.14.49;	author mcalabre;	state Exp;
branches
	7.9.1.1;
next	7.8;

7.8
date	2022.03.25.06.11.50;	author mcalabre;	state Exp;
branches
	7.8.1.1;
next	7.7;

7.7
date	2021.07.12.06.36.49;	author mcalabre;	state Exp;
branches
	7.7.1.1;
next	7.6;

7.6
date	2021.04.13.12.57.02;	author mcalabre;	state Exp;
branches
	7.6.1.1;
next	7.5;

7.5
date	2021.03.20.05.54.59;	author mcalabre;	state Exp;
branches
	7.5.1.1;
next	7.4;

7.4
date	2021.01.31.02.24.52;	author mcalabre;	state Exp;
branches
	7.4.1.1;
next	7.3;

7.3
date	2020.06.03.03.37.03;	author mcalabre;	state Exp;
branches
	7.3.1.1;
next	7.2;

7.2
date	2020.03.09.07.31.24;	author mcalabre;	state Exp;
branches
	7.2.1.1;
next	7.1;

7.1
date	2019.12.31.13.25.20;	author mcalabre;	state Exp;
branches
	7.1.1.1;
next	6.4;

6.4
date	2019.08.15.09.30.18;	author mcalabre;	state Exp;
branches
	6.4.1.1;
next	6.3;

6.3
date	2019.07.12.07.33.40;	author mcalabre;	state Exp;
branches
	6.3.1.1;
next	6.2;

6.2
date	2018.10.20.10.03.14;	author mcalabre;	state Exp;
branches
	6.2.1.1;
next	6.1;

6.1
date	2018.10.19.08.35.17;	author mcalabre;	state Exp;
branches
	6.1.1.1;
next	5.20;

5.20
date	2018.10.05.05.32.42;	author mcalabre;	state Exp;
branches
	5.20.1.1;
next	5.19;

5.19
date	2018.07.26.15.37.05;	author mcalabre;	state Exp;
branches
	5.19.1.1;
next	5.18;

5.18
date	2018.01.10.08.32.14;	author mcalabre;	state Exp;
branches
	5.18.1.1;
next	5.17;

5.17
date	2017.09.18.08.44.25;	author mcalabre;	state Exp;
branches
	5.17.1.1;
next	5.16;

5.16
date	2017.01.15.04.25.03;	author mcalabre;	state Exp;
branches
	5.16.1.1;
next	5.15;

5.15
date	2016.04.05.12.55.13;	author mcalabre;	state Exp;
branches
	5.15.1.1;
next	5.14;

5.14
date	2016.02.07.10.49.33;	author mcalabre;	state Exp;
branches
	5.14.1.1;
next	5.13;

5.13
date	2016.01.26.08.51.16;	author mcalabre;	state Exp;
branches
	5.13.1.1;
next	5.12;

5.12
date	2015.11.15.02.13.03;	author mcalabre;	state Exp;
branches
	5.12.1.1;
next	5.11;

5.11
date	2015.10.18.09.13.08;	author mcalabre;	state Exp;
branches
	5.11.1.1;
next	5.10;

5.10
date	2015.10.09.08.19.18;	author mcalabre;	state Exp;
branches
	5.10.1.1;
next	5.9;

5.9
date	2015.07.21.09.20.04;	author mcalabre;	state Exp;
branches
	5.9.1.1;
next	5.8;

5.8
date	2015.07.08.11.04.03;	author mcalabre;	state Exp;
branches
	5.8.1.1;
next	5.7;

5.7
date	2015.06.29.02.44.19;	author mcalabre;	state Exp;
branches
	5.7.1.1;
next	5.6;

5.6
date	2015.06.14.07.11.26;	author mcalabre;	state Exp;
branches
	5.6.1.1;
next	5.5;

5.5
date	2015.05.05.13.16.34;	author mcalabre;	state Exp;
branches
	5.5.1.1;
next	5.4;

5.4
date	2015.04.21.14.41.08;	author mcalabre;	state Exp;
branches
	5.4.1.1;
next	5.3;

5.3
date	2015.04.21.02.50.54;	author mcalabre;	state Exp;
branches
	5.3.1.1;
next	5.2;

5.2
date	2015.04.15.12.35.10;	author mcalabre;	state Exp;
branches
	5.2.1.1;
next	5.1;

5.1
date	2015.04.07.10.56.39;	author mcalabre;	state Exp;
branches
	5.1.1.1;
next	5.0;

5.0
date	2015.04.05.12.25.03;	author mcalabre;	state Exp;
branches
	5.0.1.1;
next	4.25;

4.25
date	2014.12.14.14.29.38;	author mcalabre;	state Exp;
branches
	4.25.1.1;
next	4.24;

4.24
date	2014.09.18.15.25.02;	author mcalabre;	state Exp;
branches
	4.24.1.1;
next	4.23;

4.23
date	2014.05.13.05.50.53;	author mcalabre;	state Exp;
branches
	4.23.1.1;
next	4.22;

4.22
date	2014.04.12.15.03.54;	author mcalabre;	state Exp;
branches
	4.22.1.1;
next	4.21;

4.21
date	2014.03.24.05.12.29;	author mcalabre;	state Exp;
branches
	4.21.1.1;
next	4.20;

4.20
date	2013.12.18.05.42.51;	author mcalabre;	state Exp;
branches
	4.20.1.1;
next	4.19;

4.19
date	2013.09.29.14.17.53;	author mcalabre;	state Exp;
branches
	4.19.1.1;
next	4.18;

4.18
date	2013.07.13.10.00.06;	author mcalabre;	state Exp;
branches
	4.18.1.1;
next	4.17;

4.17
date	2013.01.29.05.29.22;	author cal103;	state Exp;
branches
	4.17.1.1;
next	4.16;

4.16
date	2012.11.07.04.42.45;	author cal103;	state Exp;
branches
	4.16.1.1;
next	4.15;

4.15
date	2012.09.26.14.26.06;	author cal103;	state Exp;
branches
	4.15.1.1;
next	4.14;

4.14
date	2012.07.13.10.02.47;	author cal103;	state Exp;
branches
	4.14.1.1;
next	4.13;

4.13
date	2012.03.14.07.39.31;	author cal103;	state Exp;
branches
	4.13.1.1;
next	4.12;

4.12
date	2012.02.29.07.57.57;	author cal103;	state Exp;
branches
	4.12.1.1;
next	4.11;

4.11
date	2012.02.20.23.30.03;	author cal103;	state Exp;
branches
	4.11.1.1;
next	4.10;

4.10
date	2012.02.05.23.41.45;	author cal103;	state Exp;
branches
	4.10.1.1;
next	4.9;

4.9
date	2012.01.24.05.40.30;	author cal103;	state Exp;
branches
	4.9.1.1;
next	4.8;

4.8
date	2011.08.15.08.05.55;	author cal103;	state Exp;
branches
	4.8.1.1;
next	4.7;

4.7
date	2011.02.07.07.03.43;	author cal103;	state Exp;
branches
	4.7.1.1;
next	4.6;

4.6
date	2010.11.16.06.15.32;	author cal103;	state Exp;
branches
	4.6.1.1;
next	4.5;

4.5
date	2010.07.16.07.01.27;	author cal103;	state Exp;
branches
	4.5.1.1;
next	4.4;

4.4
date	2009.08.06.07.54.40;	author cal103;	state Exp;
branches
	4.4.1.1;
next	4.3;

4.3
date	2007.12.27.05.49.14;	author cal103;	state Exp;
branches
	4.3.1.1;
next	4.2;

4.2
date	2005.09.21.13.27.15;	author cal103;	state Exp;
branches
	4.2.1.1;
next	4.1;

4.1
date	2005.08.26.12.54.06;	author cal103;	state Exp;
branches;
next	4.0;

4.0
date	2005.02.04.12.19.45;	author cal103;	state Exp;
branches;
next	3.6;

3.6
date	2004.08.24.08.34.02;	author cal103;	state Exp;
branches;
next	3.5;

3.5
date	2004.06.28.05.28.22;	author mcalabre;	state Exp;
branches;
next	3.4;

3.4
date	2004.02.10.23.56.37;	author mcalabre;	state Exp;
branches;
next	3.3;

3.3
date	2003.10.22.08.56.52;	author mcalabre;	state Exp;
branches;
next	3.2;

3.2
date	2003.09.09.07.52.48;	author mcalabre;	state Exp;
branches;
next	3.1;

3.1
date	2003.04.28.05.02.51;	author mcalabre;	state Exp;
branches;
next	;

4.2.1.1
date	2005.12.05.03.23.34;	author cal103;	state Exp;
branches;
next	4.2.1.2;

4.2.1.2
date	2005.12.05.03.45.06;	author cal103;	state Exp;
branches;
next	4.2.1.3;

4.2.1.3
date	2005.12.16.03.42.59;	author cal103;	state Exp;
branches;
next	4.2.1.4;

4.2.1.4
date	2007.12.03.05.41.29;	author cal103;	state Exp;
branches;
next	4.2.1.5;

4.2.1.5
date	2007.12.22.04.01.45;	author cal103;	state Exp;
branches;
next	;

4.3.1.1
date	2007.12.27.13.26.31;	author cal103;	state Exp;
branches;
next	4.3.1.2;

4.3.1.2
date	2009.07.23.04.17.17;	author cal103;	state Exp;
branches;
next	;

4.4.1.1
date	2009.08.10.08.55.45;	author cal103;	state Exp;
branches;
next	4.4.1.2;

4.4.1.2
date	2010.01.19.03.45.24;	author cal103;	state Exp;
branches;
next	4.4.1.3;

4.4.1.3
date	2010.07.14.12.58.00;	author cal103;	state Exp;
branches;
next	;

4.5.1.1
date	2010.07.16.07.05.33;	author cal103;	state Exp;
branches;
next	;

4.6.1.1
date	2010.11.16.06.16.20;	author cal103;	state Exp;
branches;
next	4.6.1.2;

4.6.1.2
date	2011.01.14.06.35.20;	author cal103;	state Exp;
branches;
next	;

4.7.1.1
date	2011.02.07.07.04.23;	author cal103;	state Exp;
branches;
next	;

4.8.1.1
date	2011.08.15.08.07.07;	author cal103;	state Exp;
branches;
next	4.8.1.2;

4.8.1.2
date	2012.01.24.05.24.50;	author cal103;	state Exp;
branches;
next	;

4.9.1.1
date	2012.01.24.05.41.46;	author cal103;	state Exp;
branches;
next	;

4.10.1.1
date	2012.02.05.23.42.47;	author cal103;	state Exp;
branches;
next	;

4.11.1.1
date	2012.02.20.23.31.14;	author cal103;	state Exp;
branches;
next	;

4.12.1.1
date	2012.02.29.07.59.11;	author cal103;	state Exp;
branches;
next	;

4.13.1.1
date	2012.03.14.07.40.39;	author cal103;	state Exp;
branches;
next	4.13.1.2;

4.13.1.2
date	2012.07.13.03.43.52;	author cal103;	state Exp;
branches;
next	;

4.14.1.1
date	2012.07.13.10.05.05;	author cal103;	state Exp;
branches;
next	;

4.15.1.1
date	2012.09.26.14.27.53;	author cal103;	state Exp;
branches;
next	;

4.16.1.1
date	2012.11.07.04.45.58;	author cal103;	state Exp;
branches;
next	4.16.1.2;

4.16.1.2
date	2013.01.29.05.11.32;	author cal103;	state Exp;
branches;
next	;

4.17.1.1
date	2013.01.29.05.32.33;	author cal103;	state Exp;
branches;
next	;

4.18.1.1
date	2013.07.13.10.02.40;	author mcalabre;	state Exp;
branches;
next	;

4.19.1.1
date	2013.09.29.14.20.41;	author mcalabre;	state Exp;
branches;
next	;

4.20.1.1
date	2013.12.18.05.46.57;	author mcalabre;	state Exp;
branches;
next	4.20.1.2;

4.20.1.2
date	2014.03.21.06.45.26;	author mcalabre;	state Exp;
branches;
next	;

4.21.1.1
date	2014.03.24.05.15.31;	author mcalabre;	state Exp;
branches;
next	;

4.22.1.1
date	2014.04.12.15.06.34;	author mcalabre;	state Exp;
branches;
next	;

4.23.1.1
date	2014.05.13.05.53.52;	author mcalabre;	state Exp;
branches;
next	;

4.24.1.1
date	2014.09.18.15.28.12;	author mcalabre;	state Exp;
branches;
next	;

4.25.1.1
date	2014.12.14.14.32.48;	author mcalabre;	state Exp;
branches;
next	4.25.1.2;

4.25.1.2
date	2015.01.06.01.03.14;	author mcalabre;	state Exp;
branches;
next	;

5.0.1.1
date	2015.04.05.12.28.04;	author mcalabre;	state Exp;
branches;
next	;

5.1.1.1
date	2015.04.07.11.01.13;	author mcalabre;	state Exp;
branches;
next	;

5.2.1.1
date	2015.04.15.12.39.18;	author mcalabre;	state Exp;
branches;
next	;

5.3.1.1
date	2015.04.21.02.54.06;	author mcalabre;	state Exp;
branches;
next	;

5.4.1.1
date	2015.04.21.14.44.32;	author mcalabre;	state Exp;
branches;
next	;

5.5.1.1
date	2015.05.05.13.21.04;	author mcalabre;	state Exp;
branches;
next	;

5.6.1.1
date	2015.06.14.07.14.48;	author mcalabre;	state Exp;
branches;
next	;

5.7.1.1
date	2015.06.29.02.47.27;	author mcalabre;	state Exp;
branches;
next	;

5.8.1.1
date	2015.07.08.11.07.22;	author mcalabre;	state Exp;
branches;
next	;

5.9.1.1
date	2015.07.21.09.28.12;	author mcalabre;	state Exp;
branches;
next	;

5.10.1.1
date	2015.10.09.08.22.40;	author mcalabre;	state Exp;
branches;
next	;

5.11.1.1
date	2015.10.18.09.16.31;	author mcalabre;	state Exp;
branches;
next	;

5.12.1.1
date	2015.11.15.02.16.18;	author mcalabre;	state Exp;
branches;
next	5.12.1.2;

5.12.1.2
date	2016.01.25.05.22.41;	author mcalabre;	state Exp;
branches;
next	;

5.13.1.1
date	2016.01.26.08.54.36;	author mcalabre;	state Exp;
branches;
next	;

5.14.1.1
date	2016.02.07.10.52.48;	author mcalabre;	state Exp;
branches;
next	;

5.15.1.1
date	2016.04.05.12.58.39;	author mcalabre;	state Exp;
branches;
next	5.15.1.2;

5.15.1.2
date	2017.01.15.04.08.24;	author mcalabre;	state Exp;
branches;
next	;

5.16.1.1
date	2017.01.15.04.29.04;	author mcalabre;	state Exp;
branches;
next	;

5.17.1.1
date	2017.09.18.08.46.01;	author mcalabre;	state Exp;
branches;
next	5.17.1.2;

5.17.1.2
date	2018.01.10.08.27.33;	author mcalabre;	state Exp;
branches;
next	;

5.18.1.1
date	2018.01.10.08.33.04;	author mcalabre;	state Exp;
branches;
next	5.18.1.2;

5.18.1.2
date	2018.07.25.10.16.09;	author mcalabre;	state Exp;
branches;
next	;

5.19.1.1
date	2018.07.26.15.41.42;	author mcalabre;	state Exp;
branches;
next	;

5.20.1.1
date	2018.10.05.05.33.33;	author mcalabre;	state Exp;
branches;
next	;

6.1.1.1
date	2018.10.19.08.36.15;	author mcalabre;	state Exp;
branches;
next	;

6.2.1.1
date	2018.10.20.10.04.15;	author mcalabre;	state Exp;
branches;
next	6.2.1.2;

6.2.1.2
date	2019.05.10.02.13.12;	author mcalabre;	state Exp;
branches;
next	;

6.3.1.1
date	2019.07.12.07.34.37;	author mcalabre;	state Exp;
branches;
next	;

6.4.1.1
date	2019.08.15.09.31.29;	author mcalabre;	state Exp;
branches;
next	6.4.1.2;

6.4.1.2
date	2019.12.03.06.15.29;	author mcalabre;	state Exp;
branches;
next	6.4.1.3;

6.4.1.3
date	2019.12.31.03.29.47;	author mcalabre;	state Exp;
branches;
next	;

7.1.1.1
date	2019.12.31.13.28.19;	author mcalabre;	state Exp;
branches;
next	;

7.2.1.1
date	2020.03.09.07.34.50;	author mcalabre;	state Exp;
branches;
next	;

7.3.1.1
date	2020.06.03.03.38.11;	author mcalabre;	state Exp;
branches;
next	7.3.1.2;

7.3.1.2
date	2020.08.17.11.24.44;	author mcalabre;	state Exp;
branches;
next	7.3.1.3;

7.3.1.3
date	2021.01.19.14.12.19;	author mcalabre;	state Exp;
branches;
next	7.3.1.4;

7.3.1.4
date	2021.01.28.12.32.51;	author mcalabre;	state Exp;
branches;
next	;

7.4.1.1
date	2021.01.31.02.26.24;	author mcalabre;	state Exp;
branches;
next	;

7.5.1.1
date	2021.03.20.05.56.42;	author mcalabre;	state Exp;
branches;
next	;

7.6.1.1
date	2021.04.13.13.00.37;	author mcalabre;	state Exp;
branches;
next	7.6.1.2;

7.6.1.2
date	2021.07.02.03.26.24;	author mcalabre;	state Exp;
branches;
next	;

7.7.1.1
date	2021.07.12.06.38.28;	author mcalabre;	state Exp;
branches;
next	7.7.1.2;

7.7.1.2
date	2022.03.25.06.06.01;	author mcalabre;	state Exp;
branches;
next	;

7.8.1.1
date	2022.03.25.06.14.15;	author mcalabre;	state Exp;
branches;
next	;

7.9.1.1
date	2022.03.25.15.16.40;	author mcalabre;	state Exp;
branches;
next	;

7.10.1.1
date	2022.04.23.14.26.55;	author mcalabre;	state Exp;
branches;
next	;

7.11.1.1
date	2022.04.26.06.15.33;	author mcalabre;	state Exp;
branches;
next	;

7.12.1.1
date	2022.09.09.05.00.36;	author mcalabre;	state Exp;
branches;
next	;

7.13.1.1
date	2022.10.07.03.45.47;	author mcalabre;	state Exp;
branches;
next	7.13.1.2;

7.13.1.2
date	2023.06.15.04.17.22;	author mcalabre;	state Exp;
branches;
next	;

8.0.1.1
date	2023.07.01.06.22.45;	author mcalabre;	state Exp;
branches;
next	8.0.1.2;

8.0.1.2
date	2023.07.04.13.00.56;	author mcalabre;	state Exp;
branches;
next	;

8.1.1.1
date	2023.07.05.17.15.01;	author mcalabre;	state Exp;
branches;
next	;

8.2.1.1
date	2023.11.16.10.05.59;	author mcalabre;	state Exp;
branches;
next	8.2.1.2;

8.2.1.2
date	2024.04.02.13.43.15;	author mcalabre;	state Exp;
branches;
next	;

8.3.1.1
date	2024.05.13.16.35.40;	author mcalabre;	state Exp;
branches;
next	;

8.4.1.1
date	2024.10.28.13.58.42;	author mcalabre;	state Exp;
branches;
next	8.4.1.2;

8.4.1.2
date	2025.12.06.13.37.20;	author mcalabre;	state Exp;
branches;
next	;

8.5.1.1
date	2025.12.06.14.05.17;	author mcalabre;	state Exp;
branches;
next	8.5.1.2;

8.5.1.2
date	2026.03.29.13.36.20;	author mcalabre;	state Exp;
branches;
next	;

8.6.1.1
date	2026.03.29.14.19.28;	author mcalabre;	state Exp;
branches;
next	8.6.1.2;

8.6.1.2
date	2026.04.10.12.07.20;	author mcalabre;	state Exp;
branches;
next	8.6.1.3;

8.6.1.3
date	2026.04.24.14.39.27;	author mcalabre;	state Exp;
branches;
next	;


desc
@C test program for PGSBOX.
@


8.7
log
@WCSLIB 8.7
@
text
@/*============================================================================
  PGSBOX 8.7 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2026, Mark Calabretta

  This file is part of PGSBOX.

  PGSBOX is free software: you can redistribute it and/or modify it under the
  terms of the GNU Lesser General Public License as published by the Free
  Software Foundation, either version 3 of the License, or (at your option)
  any later version.

  PGSBOX is distributed in the hope that it will be useful, but WITHOUT ANY
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
  more details.

  You should have received a copy of the GNU Lesser General Public License
  along with PGSBOX.  If not, see http://www.gnu.org/licenses.

  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
  http://www.atnf.csiro.au/computing/software/wcs
  $Id: cpgtest.c,v 8.6.1.3 2026/04/24 14:39:27 mcalabre Exp mcalabre $
*=============================================================================
*
*   cpgtest
*
*---------------------------------------------------------------------------*/

// Needed to get nanosleep() from time.h.
#define _POSIX_C_SOURCE 199309L

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

#include <cpgplot.h>

#include <cpgsbox.h>
#include <wcs.h>
#include <wcsfix.h>

// Fortran name mangling.
#include <wcsconfig_f77.h>
#define lngvel_ F77_FUNC(lngvel, LNGVEL)
#define fscan_  F77_FUNC(fscan,  FSCAN)
#define pgcrfn_ F77_FUNC(pgcrfn, PGCRFN)
#define pgwcsl_ F77_FUNC(pgwcsl, PGWCSL)

int main()

{
  const double pi = 3.141592653589793238462643;
  const double d2r = pi/180.0;

  // cpgsbox() function arguments.
  char   fcode[2][4], idents[3][80], nlcprm[1], opt[2];
  int    c0[7], ci[7], gcode[2], ic, ierr, nliprm[2];
  double cache[257][4], grid1[9], grid2[9], nldprm[8];
  nlfunc_t lngvel_, fscan_, pgcrfn_, pgwcsl_;

  // Setup.
  int naxis[2] = {512, 512};

  float blc[2] = {0.5f, 0.5f};
  float trc[2];
  trc[0] = (float)naxis[0] + 0.5f;
  trc[1] = (float)naxis[1] + 0.5f;

  char devtyp[16];
  strncpy(devtyp, "/XWINDOW", 16);
  cpgbeg(0, devtyp, 1, 1);

  int nchr = 16;
  cpgqinf("TYPE", devtyp, &nchr);
  if (strcmp(devtyp, "PS") == 0  ||
     strcmp(devtyp, "VPS") == 0 ||
     strcmp(devtyp, "CPS") == 0 ||
     strcmp(devtyp, "VCPS") == 0) {
    // Switch black and white.
    cpgscr(0, 1.0f, 1.0f, 1.0f);
    cpgscr(1, 0.0f, 0.0f, 0.0f);
  }

  int large = strcmp(devtyp, "XWINDOW") == 0;
  float scl;
  if (large) {
    scl = 1.0f;
    cpgvstd();
  } else {
    scl = 0.7f;
    cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
  }

  // Yellow.
  cpgscr(2, 1.0f, 1.0f, 0.0f);
  // White.
  cpgscr(3, 1.0f, 1.0f, 1.0f);
  // Pale blue.
  cpgscr(4, 0.5f, 0.5f, 0.8f);
  // Pale red.
  cpgscr(5, 0.8f, 0.5f, 0.5f);
  // Grey.
  cpgscr(6, 0.7f, 0.7f, 0.7f);
  // Dark green.
  cpgscr(7, 0.3f, 0.5f, 0.3f);

  c0[0] = -1;
  c0[1] = -1;
  c0[2] = -1;
  c0[3] = -1;
  c0[4] = -1;
  c0[5] = -1;
  c0[6] = -1;

  cpgwnad(0.0f, 1.0f, 0.0f, 1.0f);
  cpgask(1);
  cpgpage();

  struct wcsprm wcs;
  wcs.flag = -1;

  // Allow 250ms to view the plot on fast machines.
  struct timespec nano = {(time_t)0, 250000000L};

  //--------------------------------------------------------------------------
  // Longitude-velocity map; the y-axis is regularly spaced in frequency but
  // is to be labelled as a true relativistic velocity.
  //   - PGSBOX uses subroutine LNGVEL.
  //   - Separable (i.e. orthogonal), non-linear coordinate system.
  //   - Automatic choice of coordinate increments.
  //   - Extraction of a common scaling factor.
  //   - Automatic choice of what edges to label.
  //   - Request for tickmarks (internal) for one coordinate and grid lines
  //     for the other.
  //   - Simple two-colour grid using two calls with deferred labelling on
  //     the first call.
  //   - Degree labelling.
  //   - Suppression of zero arcmin and arcsec fields in sexagesimal degree
  //     format.
  //--------------------------------------------------------------------------

  printf("\nLongitude-velocity map\n");

  // Reference pixel coordinates.
  nldprm[0] =   1.0;
  nldprm[1] = 256.0;

  // Reference pixel values.
  nldprm[2] = 0.0;
  nldprm[3] = 1.420e9;

  // Coordinate increments.
  nldprm[4] = 360.0/(naxis[0]-1);
  nldprm[5] = 4e6;

  // Rest frequency.
  nldprm[6] = 1.420e9;

  // Annotation.
  strncpy(idents[0], "galactic longitude", 80);
  strncpy(idents[1], "velocity (m/s)", 80);
  strncpy(idents[2], "HI line", 80);

  opt[0] = 'F';
  opt[1] = ' ';

  // Normal size lettering.
  cpgsch(1.0f*scl);

  // Yellow tick marks for longitude and grid lines for velocity.
  cpgsci(2);
  gcode[0] = 1;
  gcode[1] = 2;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  // Defer labelling.
  ic = -1;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 2.0, 0, grid1, 0, grid2,
    0, lngvel_, 1, 1, 7, nlcprm, nliprm, nldprm, 256, &ic, cache, &ierr);

  // Draw fiducial grid lines in white and do labelling.
  cpgsci(1);
  gcode[0] = 2;
  gcode[1] = 2;
  grid1[1] = 180.0;
  grid2[1] = 0.0;
  cpgsbox(blc, trc, idents, opt, 0, 0, c0, gcode, 0.0, 1, grid1, 1, grid2,
    0, lngvel_, 1, 1, 7, nlcprm, nliprm, nldprm, 256, &ic, cache, &ierr);

  // Draw the frame.
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();

  //--------------------------------------------------------------------------
  // Azimuth-frequency scan; this sort of output might be obtained from an
  // antenna that scans in azimuth with a receiver that scans simultaneously
  // in frequency.
  //   - PGSBOX uses subroutine FSCAN.
  //   - Non-separable (i.e. non-orthogonal) non-linear coordinate system.
  //   - Automatic choice of what edges to label; results in labelling the
  //     bottom, left and right sides of the plot.
  //   - Cyclic labelling.  FSCAN returns the azimuth in the range
  //     0 - 720 degrees but PGSBOX is set to normalize this to two cycles of
  //     0 - 360 degrees.
  //   - Logarithmic labelling.
  //   - Automatic choice of coordinate increments but with request for all
  //     grid lines for the logarithmic coordinate.
  //   - Degree labelling.
  //   - Suppression of common zero arcmin and arcsec fields in sexagesimal
  //     degree format.
  //--------------------------------------------------------------------------

  printf("\nAzimuth-frequency scan\n");

  // Reference pixel coordinates.
  nldprm[0] = 0.5;
  nldprm[1] = 0.5;

  // Reference pixel values.
  nldprm[2] = 0.0;
  nldprm[3] = 8.5;

  // Coordinate increments.
  nldprm[4] = 720.0/(naxis[0]+1);
  nldprm[5] = 0.002;

  // Rate of change of NLDPRM[3] with x-pixel.
  nldprm[6] = -0.002;

  // Annotation.
  strncpy(idents[0], "azimuth", 80);
  strncpy(idents[1], "\\gn/Hz", 80);
  strncpy(idents[2], "Frequency/azimuth scan", 80);

  opt[0] = 'D';
  opt[1] = 'L';

  // Normal size lettering.
  cpgsch(1.0f*scl);

  // Draw full grid lines.
  cpgsci(1);
  gcode[0] = 2;
  gcode[1] = 2;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  // Setting labden = 9900 forces all logarithmic grid lines to be drawn.
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 0, 9900, c0, gcode, 2.0, 0, grid1, 0, grid2,
    0, fscan_, 1, 1, 7, nlcprm, nliprm, nldprm, 256, &ic, cache, &ierr);

  // Draw the frame.
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();


  //--------------------------------------------------------------------------
  // Z versus time plot.
  //   - PGSBOX uses subroutine PGCRFN.
  //   - Separable (i.e. orthogonal), non-linear coordinate system.
  //   - Use of function PGCRFN for separable axis types.
  //   - Automatic choice of what edges to label; results in labelling the
  //     bottom and left sides of the plot.
  //   - Automatic choice of coordinate increments.
  //   - Logarithmic labelling over many orders of magnitude.
  //   - Single-character annotation on a vertical axis is upright.
  //--------------------------------------------------------------------------

  printf("\nZ versus time plot\n");

  // Function types.
  memcpy(fcode[0], "Lin ", 4);
  memcpy(fcode[1], "Log ", 4);

  // Reference pixel coordinates.
  nldprm[0] =   0.5;
  nldprm[1] = -50.0;

  // Coordinate increments.
  nldprm[2] = 0.04;
  nldprm[3] = 0.02;

  // Reference pixel values.
  nldprm[4] = -3.0;
  nldprm[5] =  1.0;

  // Annotation.
  strncpy(idents[0], "Age of universe (sec)", 80);
  strncpy(idents[1], "Y", 80);
  strncpy(idents[2], "", 80);

  opt[0] = 'L';
  opt[1] = ' ';

  // Normal size lettering.
  cpgsch(1.0f*scl);

  // Draw ticks for the first coordinate, grid lines for the second.
  cpgsci(1);
  gcode[0] = 1;
  gcode[1] = 2;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, 0, 0, c0, gcode, 2.0, 0, grid1, 0, grid2, 0,
    pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache, &ierr);

  // Draw the frame.
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();

  //--------------------------------------------------------------------------
  // Simple SIN projection near the south celestial pole.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Discovery of grid lines that do not cross any axis.
  //   - Automatic choice of what edges to label; results in labelling all
  //     sides of the plot.
  //   - Automatic choice of coordinate increments but with request for
  //     increased grid density for each coordinate.
  //   - Double precision accuracy.
  //   - Cyclic coordinates.  PGWCSL returns the right ascension in the range
  //     -180 to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
  //   - Labelling of degrees as time in the range 0 - 24h.
  //   - Suppression of labels that would overlap one another.
  //   - Sexagesimal degree labelling with automatically determined
  //     precision.
  //   - Suppression of common zero minute and second fields in sexagesimal
  //     time format.
  //--------------------------------------------------------------------------

  printf("\nSimple SIN projection\n");

  wcs.flag = -1;
  wcsini(1, 2, &wcs);

  // Set projection type to SIN.
  strncpy(wcs.ctype[0], "RA---SIN", 72);
  strncpy(wcs.ctype[1], "DEC--SIN", 72);

  // Reference pixel coordinates.
  wcs.crpix[0] = 384.0;
  wcs.crpix[1] = 256.0;

  // Coordinate increments.
  wcs.cdelt[0] = -1.0/3600000.0;
  wcs.cdelt[1] =  1.0/3600000.0;

  // Spherical coordinate references.
  double dec0 = -89.99995;
  wcs.crval[0] = 25.0;
  wcs.crval[1] = dec0;

  // Set parameters for an NCP projection.
  dec0 *= d2r;
  wcs.pv[0].i = 2;
  wcs.pv[0].m = 1;
  wcs.pv[0].value = 0.0;
  wcs.pv[0].i = 2;
  wcs.pv[1].m = 2;
  wcs.pv[1].value = cos(dec0)/sin(dec0);

  // Annotation.
  strncpy(idents[0], "Right ascension", 80);
  strncpy(idents[1], "Declination", 80);
  strncpy(idents[2], "WCS SIN projection", 80);

  opt[0] = 'G';
  opt[1] = 'E';

  // Compact lettering.
  cpgsch(0.8f*scl);

  // Draw full grid lines.
  cpgsci(1);
  gcode[0] = 2;
  gcode[1] = 2;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  // Draw the celestial grid.  The grid density is set for each world
  // coordinate by specifying LABDEN = 1224.
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 0, 1224, c0, gcode, 0.0, 0, grid1, 0, grid2,
    0, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  // Draw the frame.
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();

  //-------------------------------------------------------------------------
  // Conic equal area projection.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  //   - Coordinate system undefined in areas of the plot.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Discontinuous grid lines handled by PGWCSL.
  //   - Discovery of grid lines that do not cross any axis.
  //   - Colour control for grid and labelling.
  //   - Reduced size lettering.
  //   - Automatic choice of what edges to label; results in labelling all
  //     sides of the plot.
  //   - Automatic choice of coordinate increments.
  //   - Cyclic coordinates.  PGWCSL returns the longitude in the range -180
  //     to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
  //   - Suppression of labels that would overlap one another.
  //   - Suppression of common zero arcmin and arcsec fields in sexagesimal
  //     degree format.
  //--------------------------------------------------------------------------

  printf("\nConic equal area projection\n");

  wcsini(1, 2, &wcs);

  // Set projection type to conic equal-area.
  strncpy(wcs.ctype[0], "RA---COE", 72);
  strncpy(wcs.ctype[1], "DEC--COE", 72);

  // Reference pixel coordinates.
  wcs.crpix[0] = 256.0;
  wcs.crpix[1] = 256.0;

  // Coordinate increments.
  wcs.cdelt[0] = -1.0/3.0;
  wcs.cdelt[1] =  1.0/3.0;

  // Spherical coordinate references.
  wcs.crval[0] =  90.0;
  wcs.crval[1] =  30.0;
  wcs.lonpole  = 150.0;

  // Middle latitude and offset from standard parallels.
  wcs.npv = 2;
  wcs.pv[0].i = 2;
  wcs.pv[0].m = 1;
  wcs.pv[0].value = 60.0;
  wcs.pv[1].i = 2;
  wcs.pv[1].m = 2;
  wcs.pv[1].value = 15.0;

  // Annotation.
  strncpy(idents[0], "longitude", 80);
  strncpy(idents[1], "latitude", 80);
  strncpy(idents[2], "WCS conic equal area projection", 80);

  opt[0] = 'E';
  opt[1] = 'E';

  // Reduced size lettering.
  cpgsch(0.8f*scl);

  // Draw full grid lines.
  gcode[0] = 2;
  gcode[1] = 2;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  // Use colour to associate grid lines and labels.
  // Meridians in red.
  cpgscr(10, 0.5f, 0.0f, 0.0f);
  // Parallels in blue.
  cpgscr(11, 0.0f, 0.2f, 0.5f);
  // Longitudes in red.
  cpgscr(12, 0.8f, 0.3f, 0.0f);
  // Latitudes in blue.
  cpgscr(13, 0.0f, 0.4f, 0.7f);
  // Longitude labels in red.
  cpgscr(14, 0.8f, 0.3f, 0.0f);
  // Latitude labels in blue.
  cpgscr(15, 0.0f, 0.4f, 0.7f);
  // Title in cyan.
  cpgscr(16, 0.3f, 1.0f, 1.0f);

  ci[0] = 10;
  ci[1] = 11;
  ci[2] = 12;
  ci[3] = 13;
  ci[4] = 14;
  ci[5] = 15;
  ci[6] = 16;

  // Draw the celestial grid letting PGSBOX choose the increments.
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 0, 0, ci, gcode, 0.0, 0, grid1, 0, grid2, 1,
    pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic, cache,
    &ierr);

  // Set parameters to draw the native grid.
  wcs.crval[0] =   0.0;
  wcs.crval[1] =  60.0;
  wcs.lonpole  = 999.0;
  wcs.latpole  = 999.0;
  wcsset(&wcs);

  // We just want to delineate the boundary, in green.
  cpgsci(7);
  grid1[1] = -180.0;
  grid1[2] =  180.0;
  grid2[1] =  -90.0;
  grid2[2] =   90.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 2, grid1, 2, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  // Draw the frame.
  cpgsci(1);
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();

  //--------------------------------------------------------------------------
  // Polyconic projection with colour-coded grid.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  //   - Coordinate system undefined in areas of the plot.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Discontinuous grid lines handled by PGWCSL.
  //   - Colour coded labelling.
  //   - Colour coded grid implemented by the caller.
  //   - Basic management of the axis-crossing table (see code).
  //   - Reduced size lettering.
  //   - Tick marks external to the frame.
  //   - User selection of what edges to label with request for both
  //     coordinates to be labelled on bottom, left and top edges.
  //   - User selection of grid lines to plot.
  //   - Concatenation of annotation at bottom and left; automatically
  //     suppressed at the top since only one coordinate is labelled there.
  //   - Suppression of labels that would overlap one another.
  //   - Degree labelling.
  //   - Labelling of degrees as time in the range -12 - +12h.
  //   - Suppression of common zero minute and second fields in sexagesimal
  //     time format.
  //--------------------------------------------------------------------------

  printf("\nPolyconic projection with colour-coded grid\n");

  wcsini(1, 2, &wcs);

  // Set projection type to polyconic.
  strncpy(wcs.ctype[0], "RA---PCO", 72);
  strncpy(wcs.ctype[1], "DEC--PCO", 72);

  // Reference pixel coordinates.
  wcs.crpix[0] = 192.0;
  wcs.crpix[1] = 640.0;

  // Rotate 30 degrees.
  double rotn = 30.0*d2r;
  *(wcs.pc)   =  cos(rotn);
  *(wcs.pc+1) =  sin(rotn);
  *(wcs.pc+2) = -sin(rotn);
  *(wcs.pc+3) =  cos(rotn);

  // Coordinate increments.
  wcs.cdelt[0] = -1.0/5.0;
  wcs.cdelt[1] =  1.0/5.0;

  // Spherical coordinate references.
  wcs.crval[0] = 332.0;
  wcs.crval[1] =  40.0;
  wcs.lonpole  = -30.0;

  // Annotation.
  strncpy(idents[0], "Hour angle", 80);
  strncpy(idents[1], "Declination", 80);
  strncpy(idents[2], "WCS polyconic projection", 80);

  opt[0] = 'H';
  opt[1] = 'B';

  // Reduced size lettering.
  cpgsch(0.9f*scl);

  // Draw external (TIKLEN < 0) tick marks every 5 degrees.
  gcode[0] = 1;
  gcode[1] = 1;
  double tiklen = -2.0;

  cpgsci(6);
  grid1[0] = 5.0;
  grid2[0] = 5.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, tiklen, 0, grid1, 0,
    grid2, 1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
    &ic, cache, &ierr);

  // Resetting the table index to zero causes information about the
  // tick marks to be discarded.
  ic = 0;

  // Draw full grid lines in yellow rather than tick marks.
  cpgsci(2);
  gcode[0] = 2;
  gcode[1] = 2;

  // Draw the primary meridian and equator.
  grid1[1] = 0.0;
  grid2[1] = 0.0;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 1, grid1, 1, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  // At this point the axis-crossing table will have entries for the
  // primary meridian and equator.  Labelling was deferred in the
  // previous call, and the table is passed intact on the second call
  // to accumulate further axis-crossings.

  // Draw 90 degree meridians and poles in white.
  cpgsci(3);
  grid1[1] =  90.0;
  grid1[2] = 180.0;
  grid1[3] = 270.0;
  grid2[1] = -90.0;
  grid2[2] =  90.0;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 3, grid1, 2, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  // Draw the first set of 15 degree meridians and parallels in blue.
  cpgsci(4);
  grid1[1] =  15.0;
  grid1[2] =  60.0;
  grid1[3] = 105.0;
  grid1[4] = 150.0;
  grid1[5] = 195.0;
  grid1[6] = 240.0;
  grid1[7] = 285.0;
  grid1[8] = 330.0;
  grid2[1] = -75.0;
  grid2[2] = -30.0;
  grid2[3] =  15.0;
  grid2[4] =  60.0;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 8, grid1, 4, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  // Draw the second set of 15 degree meridians and parallels in red.
  cpgsci(5);
  grid1[1] =  30.0;
  grid1[2] =  75.0;
  grid1[3] = 120.0;
  grid1[4] = 165.0;
  grid1[5] = 210.0;
  grid1[6] = 255.0;
  grid1[7] = 300.0;
  grid1[8] = 345.0;
  grid2[1] = -60.0;
  grid2[2] = -15.0;
  grid2[3] =  30.0;
  grid2[4] =  75.0;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 8, grid1, 4, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  // The axis-crossing table has now accumulated information for all of
  // the preceding meridians and parallels but no labels have been
  // produced.  It will acquire information for the the next set of
  // meridians and parallels before being processed by this call to
  // PGSBOX which finally produces the labels.

  // Draw the 45 degree meridians and parallels in grey and use colour
  // to differentiate grid labels.
  // Meridians and parallels in grey.
  cpgscr(10, 0.7f, 0.7f, 0.7f);
  cpgscr(11, 0.7f, 0.7f, 0.7f);
  // Longitudes tinged red.
  cpgscr(12, 1.0f, 0.9f, 0.6f);
  // Latitudes tinged green.
  cpgscr(13, 0.8f, 1.0f, 0.9f);
  // Longitude labels tinged red.
  cpgscr(14, 1.0f, 0.9f, 0.6f);
  // Latitude labels tinged green.
  cpgscr(15, 0.8f, 1.0f, 0.9f);
  // Title in white.
  cpgscr(16, 1.0f, 1.0f, 1.0f);

  ci[0] = 10;
  ci[1] = 11;
  ci[2] = 12;
  ci[3] = 13;
  ci[4] = 14;
  ci[5] = 15;
  ci[6] = 16;

  cpgsci(6);

  // Tell PGSBOX what edges to label.
  grid1[1] =  45.0;
  grid1[2] = 135.0;
  grid1[3] = 225.0;
  grid1[4] = 315.0;
  grid2[1] = -45.0;
  grid2[2] =  45.0;
  cpgsbox(blc, trc, idents, opt, 2333, 0, ci, gcode, 0.0, 4, grid1, 2, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  // Native grid in green (delineates boundary).
  cpgsci(7);
  grid1[1] = -180.0;
  grid1[2] =  180.0;
  grid2[1] = -999.0;

  wcs.crval[0] =   0.0;
  wcs.crval[1] =   0.0;
  wcs.lonpole  = 999.0;
  wcsset(&wcs);

  ic = -1;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 2, grid1, 1, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  // Draw the frame.
  cpgsci(1);
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();

  //--------------------------------------------------------------------------
  // Plate Carree projection.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - Rectangular image.
  //   - Dual coordinate grids.
  //   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Discontinuous grid lines handled by PGWCSL.
  //   - Colour coding of grid and labelling.
  //   - Reduced size lettering.
  //   - Manual labelling control.
  //   - Manual and automatic choice of coordinate increments.
  //   - Cyclic coordinates.  PGWCSL returns the longitude in the range -180
  //     to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
  //   - Suppression of labels that would overlap one another.
  //--------------------------------------------------------------------------

  printf("\nPlate Carree projection\n");

  naxis[0] = 181;
  naxis[1] =  91;

  blc[0] = 0.5f;
  blc[1] = 0.5f;
  trc[0] = (float)naxis[0] + 0.5f;
  trc[1] = (float)naxis[1] + 0.5f;

  // Reset viewport for rectangular image.
  if (large) {
    cpgvstd();
  } else {
    cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
  }
  cpgwnad(0.0f, 1.0f, 0.0f, ((float)naxis[1])/((float)naxis[0]));

  wcsini(1, 2, &wcs);

  // Set projection type to plate carree.
  strncpy(wcs.ctype[0], "GLON-CAR", 72);
  strncpy(wcs.ctype[1], "GLAT-CAR", 72);

  // Reference pixel coordinates.
  wcs.crpix[0] = 226.0;
  wcs.crpix[1] =  46.0;

  // Linear transformation matrix.
  rotn = 15.0*d2r;
  *(wcs.pc)   =  cos(rotn);
  *(wcs.pc+1) =  sin(rotn);
  *(wcs.pc+2) = -sin(rotn);
  *(wcs.pc+3) =  cos(rotn);

  // Coordinate increments.
  wcs.cdelt[0] = -1.0;
  wcs.cdelt[1] =  1.0;

  // Set parameters to draw the native grid.
  wcs.crval[0] = 0.0;
  wcs.crval[1] = 0.0;

  // The reference pixel was defined so that the native longitude runs
  // from 225 deg to 45 deg and this will cause the grid to be truncated
  // at the 180 deg boundary.  However, being a cylindrical projection
  // it is possible to recentre it in longitude.  cylfix() will modify
  // modify CRPIX, CRVAL, and LONPOLE to suit.

  cylfix(naxis, &wcs);

  // Annotation.
  strncpy(idents[0], "", 80);
  strncpy(idents[1], "", 80);
  strncpy(idents[2], "WCS plate caree projection", 80);

  opt[0] = 'C';
  opt[1] = 'C';

  // Reduced size lettering.
  cpgsch(0.8f*scl);

  // Draw full grid lines.
  gcode[0] = 2;
  gcode[1] = 2;

  // Draw native grid in green.
  cpgscr(16, 0.0f, 0.2f, 0.0f);
  // Title in cyan.
  cpgscr(17, 0.3f, 1.0f, 1.0f);

  ci[0] = 16;
  ci[1] = 16;
  ci[2] =  7;
  ci[3] =  7;
  ci[4] = -1;
  ci[5] = -1;
  ci[6] = 17;

  grid1[0] = 15.0;
  grid2[0] = 15.0;
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 2100, 0, ci, gcode, 0.0, 0, grid1, 0, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  // Reset CRPIX previously modified by cylfix().
  wcs.crpix[0] = 226.0;
  wcs.crpix[1] =  46.0;

  // Galactic reference coordinates.
  wcs.crval[0] =  30.0;
  wcs.crval[1] =  35.0;
  wcs.lonpole  = 999.0;
  wcsset(&wcs);

  cylfix(naxis, &wcs);

  // Annotation.
  strncpy(idents[0], "longitude", 80);
  strncpy(idents[1], "latitude", 80);
  strncpy(idents[2], "", 80);

  opt[0] = 'E';
  opt[1] = 'E';

  // Use colour to associate grid lines and labels.
  // Meridians in red.
  cpgscr(10, 0.5f, 0.0f, 0.0f);
  // Parallels in blue.
  cpgscr(11, 0.0f, 0.2f, 0.5f);
  // Longitudes in red.
  cpgscr(12, 0.8f, 0.3f, 0.0f);
  // Latitudes in blue.
  cpgscr(13, 0.0f, 0.4f, 0.7f);
  // Longitude labels in red.
  cpgscr(14, 0.8f, 0.3f, 0.0f);
  // Latitude labels in blue.
  cpgscr(15, 0.0f, 0.4f, 0.7f);

  ci[0] = 10;
  ci[1] = 11;
  ci[2] = 12;
  ci[3] = 13;
  ci[4] = 14;
  ci[5] = 15;
  ci[6] = -1;

  grid1[0] = 0.0;
  grid2[0] = 0.0;

  // Draw the celestial grid letting PGSBOX choose the increments.
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 21, 0, ci, gcode, 0.0, 0, grid1, 0, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  // Draw the frame.
  cpgsci(1);
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();

  //--------------------------------------------------------------------------
  // Plate Carree projection.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - BLC, TRC unrelated to pixel coordinates.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Poles and 180 meridian projected along edges of the frame.
  //   - Reduced size lettering.
  //   - Manual and automatic choice of coordinate increments.
  //   - Suppression of common zero minute and second fields in sexagesimal
  //     time format.
  //--------------------------------------------------------------------------

  printf("\nPlate Carree projection\n");

  blc[0] = -180.0f;
  blc[1] =  -90.0f;
  trc[0] =  180.0f;
  trc[1] =  +90.0f;

  //  Reset viewport for rectangular image.
  if (large) {
    cpgvstd();
  } else {
    cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
  }
  cpgwnad (blc[0], trc[0], blc[1], trc[1]);

  wcsini(1, 2, &wcs);

  // Set projection type to plate carree.
  strncpy(wcs.ctype[0], "RA---CAR", 72);
  strncpy(wcs.ctype[1], "DEC--CAR", 72);

  // Reference pixel coordinates.
  wcs.crpix[0] = 0.0;
  wcs.crpix[1] = 0.0;

  // Coordinate increments.
  wcs.cdelt[0] = -1.0;
  wcs.cdelt[1] =  1.0;

  // Set parameters to draw the native grid.
  wcs.crval[0] = 0.0;
  wcs.crval[1] = 0.0;

  // Annotation.
  strncpy(idents[0], "Right ascension", 80);
  strncpy(idents[1], "Declination", 80);
  strncpy(idents[2], "WCS plate caree projection", 80);

  opt[0] = 'G';
  opt[1] = 'E';

  // Reduced size lettering.
  cpgsch(0.7f*scl);

  // Draw full grid lines.
  gcode[0] = 2;
  gcode[1] = 2;

  cpgsci(1);

  grid1[0] = 0.0;
  grid2[0] = 0.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, 2121, 1212, c0, gcode, 0.0, 0, grid1, 0,
    grid2, 1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
    &ic, cache, &ierr);

  // Draw the frame.
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();

  //--------------------------------------------------------------------------
  // Cylindrical perspective projection.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - BLC, TRC unrelated to pixel coordinates.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Reduced size lettering.
  //   - Manual and automatic choice of coordinate increments.
  //   - Suppression of common zero minute and second fields in sexagesimal
  //     time format.
  //--------------------------------------------------------------------------

  printf("\nCylindrical perspective projection\n");

  blc[0] = -180.0f;
  blc[1] =  -90.0f;
  trc[0] =  180.0f;
  trc[1] =  +90.0f;

  //  Reset viewport for rectangular image.
  if (large) {
    cpgvstd();
  } else {
    cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
  }
  cpgwnad (blc[0], trc[0], blc[1], trc[1]);

  wcsini(1, 2, &wcs);

  // Set projection type to cylindrical perspective.
  strncpy(wcs.ctype[0], "RA---CYP", 72);
  strncpy(wcs.ctype[1], "DEC--CYP", 72);

  // Reference pixel coordinates.
  wcs.crpix[0] = 0.0;
  wcs.crpix[1] = 0.0;

  // Coordinate increments.
  wcs.cdelt[0] = -1.0;
  wcs.cdelt[1] =  1.0;

  // Set parameters to draw the native grid.
  wcs.crval[0] =  45.0;
  wcs.crval[1] = -90.0;
  wcs.lonpole  = 999.0;

  // mu and lambda projection parameters.
  wcs.npv = 2;
  wcs.pv[0].i = 2;
  wcs.pv[0].m = 1;
  wcs.pv[0].value = 0.0;
  wcs.pv[1].i = 2;
  wcs.pv[1].m = 2;
  wcs.pv[1].value = 1.0;

  // Annotation.
  strncpy(idents[0], "Right ascension", 80);
  strncpy(idents[1], "Declination", 80);
  strncpy(idents[2], "WCS cylindrical perspective projection", 80);

  opt[0] = 'G';
  opt[1] = 'E';

  // Reduced size lettering.
  cpgsch(0.7f*scl);

  // Draw full grid lines.
  gcode[0] = 2;
  gcode[1] = 2;

  cpgsci(1);

  grid1[0] = 0.0;
  grid2[0] = 0.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, 2121, 1212, c0, gcode, 0.0, 0, grid1, 0,
    grid2, 1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
    &ic, cache, &ierr);

  // Draw the frame.
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();

  //--------------------------------------------------------------------------
  // Gnomonic projection.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Reduced size lettering.
  //   - Manual and automatic choice of coordinate increments.
  //   - Suppression of common zero minute and second fields in sexagesimal
  //     time format.
  //--------------------------------------------------------------------------

  printf("\nTAN projection\n");

  naxis[0] = 100;
  naxis[1] = 100;

  blc[0] = 0.5f;
  blc[1] = 0.5f;
  trc[0] = (float)naxis[0] + 0.5f;
  trc[1] = (float)naxis[1] + 0.5f;

  //  Reset viewport for rectangular image.
  if (large) {
    cpgvstd();
  } else {
    cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
  }
  cpgwnad(0.0f, 1.0f, 0.0f, ((float)naxis[1])/((float)naxis[0]));

  wcsini(1, 2, &wcs);

  // Set projection type to gnomonic.
  strncpy(wcs.ctype[0], "RA---TAN", 72);
  strncpy(wcs.ctype[1], "DEC--TAN", 72);

  // Reference pixel coordinates.
  wcs.crpix[0] = 50.5;
  wcs.crpix[1] =  1.0;

  // Coordinate increments.
  wcs.cdelt[0] = 1e-3;
  wcs.cdelt[1] = 1e-3;

  // Set parameters to draw the native grid.
  wcs.crval[0] =  45.0;
  wcs.crval[1] = -89.7;
  wcs.lonpole  = 999.0;

  // Annotation.
  strncpy(idents[0], "Right ascension", 80);
  strncpy(idents[1], "Declination", 80);
  strncpy(idents[2], "WCS TAN projection", 80);

  opt[0] = 'E';
  opt[1] = 'E';

  // Reduced size lettering.
  cpgsch(0.7f*scl);

  // Draw full grid lines.
  gcode[0] = 2;
  gcode[1] = 2;

  cpgsci(1);

  grid1[0] = 0.0;
  grid2[0] = 0.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, 0, 1212, c0, gcode, 0.0, 0, grid1, 0,
    grid2, 0, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
    &ic, cache, &ierr);

  // Draw the frame.
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();

  //--------------------------------------------------------------------------
  // Linear-linear plot with two types of alternative labelling.
  //   - PGSBOX uses subroutine PGCRFN.
  //   - Separable (i.e. orthogonal), linear coordinate system.
  //   - Use of function PGCRFN for separable axis types.
  //   - Alternative labelling and axis annotation.
  //   - Direct manipulation of the axis-crossing table.
  //   - Tick mark and grid line control.
  //   - User selection of what edges to label.
  //   - Automatic choice of coordinate increments.
  //--------------------------------------------------------------------------

  printf("\nLinear plot with alternative labelling\n");

  if (large) {
    cpgvstd();
  } else {
    cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
  }
  cpgwnad(0.0f, 1.0f, 0.0f, 1.0f);

  naxis[0] = 512;
  naxis[1] = 512;

  blc[0] = 0.5f;
  blc[1] = 0.5f;
  trc[0] = (float)naxis[0] + 0.5f;
  trc[1] = (float)naxis[1] + 0.5f;

  // Function types.
  memcpy(fcode[0], "Lin ", 4);
  memcpy(fcode[1], "Lin ", 4);

  // Reference pixel coordinates.
  nldprm[0] = 0.5;
  nldprm[1] = 0.5;

  // Coordinate increments.
  nldprm[2] = 0.03;
  nldprm[3] = 0.03;

  // Reference pixel values.
  nldprm[4] = 20.0;
  nldprm[5] =  0.0;

  // Annotation.
  strncpy(idents[0], "temperature of frog (\\uo\\dC)", 80);
  strncpy(idents[1], "distance hopped (m)", 80);
  strncpy(idents[2], "", 80);

  opt[0] = ' ';
  opt[1] = ' ';

  // Reduced size lettering.
  cpgsch(0.8f*scl);

  // Draw tick marks at the bottom for the first coordinate, grid lines
  // for the second.  Setting GCODE[0] = -1 inhibits information being
  // stored for labels on the top edge while GCODE[1] = 2 causes
  // information to be stored for labels on the right edge even if those
  // labels are not actually produced.
  cpgsci(1);
  gcode[0] = -1;
  gcode[1] =  2;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  // Set LABCTL = 21 to label the bottom and left edges only.
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 21, 0, c0, gcode, 2.0, 0, grid1, 0, grid2,
    0, pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache, &ierr);

  // Information for labels on the right edge was stored in the crossing
  // table on the first call to PGSBOX.  We now want to manipulate it to
  // convert metres to feet.  Note that while it's a simple matter to draw
  // alternative sets of tick marks on opposite edges of the frame, as
  // with the two temperature scales, we have the slightly more difficult
  // requirement of labelling grid lines with different values at each
  // end.
  for (int j = 0; j <= ic; j++) {
    // Look for entries associated with the right edge of the frame.
    if (cache[j][0] == 4.0) {
      // Convert to feet, rounding to the nearest 0.1.
      cache[j][3] *= 1e3/(25.4*12.0);
      cache[j][3] = floor(cache[j][3]*10.0 + 0.5)/10.0;
    }
  }

  // Annotation for the right edge.
  strncpy(idents[0], "", 80);
  strncpy(idents[1], "(feet)", 80);

  // Set LABCTL = 12000 to label the right edge with the second coordinate
  // without redrawing the grid lines.
  cpgsbox(blc, trc, idents, opt, 12000, 0, c0, gcode, 2.0, 0, grid1, 0,
    grid2, 0, pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache,
    &ierr);

  // The alternative temperature scale in Fahrenheit is to be constructed
  // with a new set of tick marks.
  nldprm[2] = nldprm[2]*1.8;
  nldprm[4] = nldprm[4]*1.8 + 32.0;

  // Draw tick marks at the top for the first coordinate, don't redo grid
  // lines for the second.
  gcode[0] = -100;
  gcode[1] = 0;

  // Annotation for the top edge.
  strncpy(idents[0], "(\\uo\\dF)", 80);
  strncpy(idents[1], "", 80);

  // Set LABCTL = 100 to label the top edge; Set IC = -1 to redetermine
  // the coordinate extrema.
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 100, 0, c0, gcode, 2.0, 0, grid1, 0, grid2,
    0, pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache, &ierr);

  // Draw the frame.
  cpgbox("bc", 0.0f, 0, "bc", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();

  //--------------------------------------------------------------------------
  // Calendar axes using subroutine PGLBOX.
  //   - Separable (i.e. orthogonal), linear coordinate system.
  //   - Use of PGLBOX for simple linear axis types.
  //   - Automatic choice of what edges to label; results in labelling the
  //     bottom and left sides of the plot.
  //   - Automatic choice of coordinate increments.
  //   - Calendar date axis labelling.
  //   - Single-character annotation on a vertical axis is upright.
  //--------------------------------------------------------------------------

  printf("\nCalendar axes using subroutine PGLBOX\n");

  cpgswin(51900.0f, 52412.0f, 51900.0f, 57020.0f);

  // Annotation.
  strncpy(idents[0], "Date started", 80);
  strncpy(idents[1], "Date finished", 80);
  strncpy(idents[2], "Calendar axes using subroutine PGLBOX", 80);

  opt[0] = 'Y';
  opt[1] = 'Y';

  // Reduced size lettering.
  cpgsch(0.7f*scl);

  // Draw tick marks on each axis.
  cpgsci(1);
  gcode[0] = 1;
  gcode[1] = 1;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  ic = -1;
  cpglbox(idents, opt, 0, 0, c0, gcode, 2.0, 0, grid1, 0, grid2, 0, 256, &ic,
    cache, &ierr);

  // Draw the frame.
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();

  //--------------------------------------------------------------------------
  // Simple linear axes handled by PGWCSL.
  //   - Separable (i.e. orthogonal), linear coordinate system.
  //   - Automatic choice of what edges to label; results in labelling the
  //     bottom and left sides of the plot.
  //   - Automatic choice of coordinate increments.
  //   - Tick marks and labels at the edges of the frame.
  //   - Single-character annotation on a vertical axis is upright.
  //--------------------------------------------------------------------------

  printf("\nSimple linear axes handled by pgwcsl()\n");

  naxis[0] = 3;
  naxis[1] = 3;

  blc[0] = 0.5f;
  blc[1] = 0.5f;
  trc[0] = (float)naxis[0] + 0.5f;
  trc[1] = (float)naxis[1] + 0.5f;

  wcsini(1, 2, &wcs);

  strncpy(wcs.ctype[0], "x", 72);
  strncpy(wcs.ctype[1], "y", 72);

  // Reference pixel coordinates.
  wcs.crpix[0] = 2.0;
  wcs.crpix[1] = 2.0;

  // Coordinate increments.
  wcs.cdelt[0] = 1.0;
  wcs.cdelt[1] = 1.0;

  // Spherical coordinate references.
  wcs.crval[0] = 2.0;
  wcs.crval[1] = 2.0;

  // Annotation.
  strncpy(idents[0], "X", 80);
  strncpy(idents[1], "Y", 80);
  strncpy(idents[2], "Simple linear axes handled by pgwcsl()", 80);

  opt[0] = ' ';
  opt[1] = ' ';

  // Reduced size lettering.
  cpgsch(0.8f*scl);

  // Draw full grid lines.
  cpgsci(1);
  gcode[0] = 1;
  gcode[1] = 1;

  grid1[0] = 0.0;
  grid2[0] = 0.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, 0, 0, c0, gcode, 2.0, 0, grid1, 0, grid2,
    0, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  // Draw the frame.
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

  nanosleep(&nano, 0x0);
  cpgpage();

  //--------------------------------------------------------------------------

  wcsfree(&wcs);

  cpgask(0);
  cpgend();

  return 0;
}
@


8.6
log
@WCSLIB 8.6
@
text
@d2 1
a2 1
  PGSBOX 8.6 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: cpgtest.c,v 8.5.1.2 2026/03/29 13:36:20 mcalabre Exp mcalabre $
d67 2
a68 2
  trc[0] = naxis[0] + 0.5f;
  trc[1] = naxis[1] + 0.5f;
d71 1
a71 1
  strcpy(devtyp, "/XWINDOW");
d161 3
a163 3
  strcpy(idents[0], "galactic longitude");
  strcpy(idents[1], "velocity (m/s)");
  strcpy(idents[2], "HI line");
d235 3
a237 3
  strcpy(idents[0], "azimuth");
  strcpy(idents[1], "\\gn/Hz");
  strcpy(idents[2], "Frequency/azimuth scan");
d295 3
a297 3
  strcpy(idents[0], "Age of universe (sec)");
  strcpy(idents[1], "Y");
  strcpy(idents[2], "");
d349 2
a350 2
  strcpy(wcs.ctype[0], "RA---SIN");
  strcpy(wcs.ctype[1], "DEC--SIN");
d375 3
a377 3
  strcpy(idents[0], "Right ascension");
  strcpy(idents[1], "Declination");
  strcpy(idents[2], "WCS SIN projection");
d430 2
a431 2
  strcpy(wcs.ctype[0], "RA---COE");
  strcpy(wcs.ctype[1], "DEC--COE");
d456 3
a458 3
  strcpy(idents[0], "longitude");
  strcpy(idents[1], "latitude");
  strcpy(idents[2], "WCS conic equal area projection");
d557 2
a558 2
  strcpy(wcs.ctype[0], "RA---PCO");
  strcpy(wcs.ctype[1], "DEC--PCO");
d581 3
a583 3
  strcpy(idents[0], "Hour angle");
  strcpy(idents[1], "Declination");
  strcpy(idents[2], "WCS polyconic projection");
d761 4
a764 4
  blc[0] = 0.5;
  blc[1] = 0.5;
  trc[0] = naxis[0] + 0.5;
  trc[1] = naxis[1] + 0.5;
d777 2
a778 2
  strcpy(wcs.ctype[0], "GLON-CAR");
  strcpy(wcs.ctype[1], "GLAT-CAR");
d808 3
a810 3
  strcpy(idents[0], "");
  strcpy(idents[1], "");
  strcpy(idents[2], "WCS plate caree projection");
d855 3
a857 3
  strcpy(idents[0], "longitude");
  strcpy(idents[1], "latitude");
  strcpy(idents[2], "");
d914 4
a917 4
  blc[0] = -180.0;
  blc[1] =  -90.0;
  trc[0] =  180.0;
  trc[1] =  +90.0;
d930 2
a931 2
  strcpy(wcs.ctype[0], "RA---CAR");
  strcpy(wcs.ctype[1], "DEC--CAR");
d946 3
a948 3
  strcpy(idents[0], "Right ascension");
  strcpy(idents[1], "Declination");
  strcpy(idents[2], "WCS plate caree projection");
d989 4
a992 4
  blc[0] = -180.0;
  blc[1] =  -90.0;
  trc[0] =  180.0;
  trc[1] =  +90.0;
d1005 2
a1006 2
  strcpy(wcs.ctype[0], "RA---CYP");
  strcpy(wcs.ctype[1], "DEC--CYP");
d1031 3
a1033 3
  strcpy(idents[0], "Right ascension");
  strcpy(idents[1], "Declination");
  strcpy(idents[2], "WCS cylindrical perspective projection");
d1076 4
a1079 4
  blc[0] = 0.5;
  blc[1] = 0.5;
  trc[0] = naxis[0] + 0.5;
  trc[1] = naxis[1] + 0.5;
d1092 2
a1093 2
  strcpy(wcs.ctype[0], "RA---TAN");
  strcpy(wcs.ctype[1], "DEC--TAN");
d1109 3
a1111 3
  strcpy(idents[0], "Right ascension");
  strcpy(idents[1], "Declination");
  strcpy(idents[2], "WCS TAN projection");
d1163 4
a1166 4
  blc[0] = 0.5;
  blc[1] = 0.5;
  trc[0] = naxis[0] + 0.5;
  trc[1] = naxis[1] + 0.5;
d1185 3
a1187 3
  strcpy(idents[0], "temperature of frog (\\uo\\dC)");
  strcpy(idents[1], "distance hopped (m)");
  strcpy(idents[2], "");
d1228 2
a1229 2
  strcpy(idents[0], "");
  strcpy(idents[1], "(feet)");
d1248 2
a1249 2
  strcpy(idents[0], "(\\uo\\dF)");
  strcpy(idents[1], "");
d1279 3
a1281 3
  strcpy(idents[0], "Date started");
  strcpy(idents[1], "Date finished");
  strcpy(idents[2], "Calendar axes using subroutine PGLBOX");
d1321 4
a1324 4
  blc[0] = 0.5;
  blc[1] = 0.5;
  trc[0] = naxis[0] + 0.5;
  trc[1] = naxis[1] + 0.5;
d1328 2
a1329 2
  strcpy(wcs.ctype[0], "x");
  strcpy(wcs.ctype[1], "y");
d1344 3
a1346 3
  strcpy(idents[0], "X");
  strcpy(idents[1], "Y");
  strcpy(idents[2], "Simple linear axes handled by pgwcsl()");
@


8.6.1.1
log
@WCSLIB 8.6 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 8.6 2026/03/29 13:53:57 mcalabre Exp $
@


8.6.1.2
log
@Inconsequential changes prompted by clang-tidy:
 - Replaced use of strcpy() with strncpy()
   (clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling).
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 8.6.1.1 2026/03/29 14:19:28 mcalabre Exp mcalabre $
d71 1
a71 1
  strncpy(devtyp, "/XWINDOW", 16);
d161 3
a163 3
  strncpy(idents[0], "galactic longitude", 80);
  strncpy(idents[1], "velocity (m/s)", 80);
  strncpy(idents[2], "HI line", 80);
d235 3
a237 3
  strncpy(idents[0], "azimuth", 80);
  strncpy(idents[1], "\\gn/Hz", 80);
  strncpy(idents[2], "Frequency/azimuth scan", 80);
d295 3
a297 3
  strncpy(idents[0], "Age of universe (sec)", 80);
  strncpy(idents[1], "Y", 80);
  strncpy(idents[2], "", 80);
d349 2
a350 2
  strncpy(wcs.ctype[0], "RA---SIN", 72);
  strncpy(wcs.ctype[1], "DEC--SIN", 72);
d375 3
a377 3
  strncpy(idents[0], "Right ascension", 80);
  strncpy(idents[1], "Declination", 80);
  strncpy(idents[2], "WCS SIN projection", 80);
d430 2
a431 2
  strncpy(wcs.ctype[0], "RA---COE", 72);
  strncpy(wcs.ctype[1], "DEC--COE", 72);
d456 3
a458 3
  strncpy(idents[0], "longitude", 80);
  strncpy(idents[1], "latitude", 80);
  strncpy(idents[2], "WCS conic equal area projection", 80);
d557 2
a558 2
  strncpy(wcs.ctype[0], "RA---PCO", 72);
  strncpy(wcs.ctype[1], "DEC--PCO", 72);
d581 3
a583 3
  strncpy(idents[0], "Hour angle", 80);
  strncpy(idents[1], "Declination", 80);
  strncpy(idents[2], "WCS polyconic projection", 80);
d777 2
a778 2
  strncpy(wcs.ctype[0], "GLON-CAR", 72);
  strncpy(wcs.ctype[1], "GLAT-CAR", 72);
d808 3
a810 3
  strncpy(idents[0], "", 80);
  strncpy(idents[1], "", 80);
  strncpy(idents[2], "WCS plate caree projection", 80);
d855 3
a857 3
  strncpy(idents[0], "longitude", 80);
  strncpy(idents[1], "latitude", 80);
  strncpy(idents[2], "", 80);
d930 2
a931 2
  strncpy(wcs.ctype[0], "RA---CAR", 72);
  strncpy(wcs.ctype[1], "DEC--CAR", 72);
d946 3
a948 3
  strncpy(idents[0], "Right ascension", 80);
  strncpy(idents[1], "Declination", 80);
  strncpy(idents[2], "WCS plate caree projection", 80);
d1005 2
a1006 2
  strncpy(wcs.ctype[0], "RA---CYP", 72);
  strncpy(wcs.ctype[1], "DEC--CYP", 72);
d1031 3
a1033 3
  strncpy(idents[0], "Right ascension", 80);
  strncpy(idents[1], "Declination", 80);
  strncpy(idents[2], "WCS cylindrical perspective projection", 80);
d1092 2
a1093 2
  strncpy(wcs.ctype[0], "RA---TAN", 72);
  strncpy(wcs.ctype[1], "DEC--TAN", 72);
d1109 3
a1111 3
  strncpy(idents[0], "Right ascension", 80);
  strncpy(idents[1], "Declination", 80);
  strncpy(idents[2], "WCS TAN projection", 80);
d1185 3
a1187 3
  strncpy(idents[0], "temperature of frog (\\uo\\dC)", 80);
  strncpy(idents[1], "distance hopped (m)", 80);
  strncpy(idents[2], "", 80);
d1228 2
a1229 2
  strncpy(idents[0], "", 80);
  strncpy(idents[1], "(feet)", 80);
d1248 2
a1249 2
  strncpy(idents[0], "(\\uo\\dF)", 80);
  strncpy(idents[1], "", 80);
d1279 3
a1281 3
  strncpy(idents[0], "Date started", 80);
  strncpy(idents[1], "Date finished", 80);
  strncpy(idents[2], "Calendar axes using subroutine PGLBOX", 80);
d1328 2
a1329 2
  strncpy(wcs.ctype[0], "x", 72);
  strncpy(wcs.ctype[1], "y", 72);
d1344 3
a1346 3
  strncpy(idents[0], "X", 80);
  strncpy(idents[1], "Y", 80);
  strncpy(idents[2], "Simple linear axes handled by pgwcsl()", 80);
@


8.6.1.3
log
@Further inconsequential changes prompted by clang-tidy:
 - Rewrote asignments to float variables to avoid implicit casts from double
   (bugprone-narrowing-conversions).
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 8.6.1.2 2026/04/10 12:07:20 mcalabre Exp mcalabre $
d67 2
a68 2
  trc[0] = (float)naxis[0] + 0.5f;
  trc[1] = (float)naxis[1] + 0.5f;
d761 4
a764 4
  blc[0] = 0.5f;
  blc[1] = 0.5f;
  trc[0] = (float)naxis[0] + 0.5f;
  trc[1] = (float)naxis[1] + 0.5f;
d914 4
a917 4
  blc[0] = -180.0f;
  blc[1] =  -90.0f;
  trc[0] =  180.0f;
  trc[1] =  +90.0f;
d989 4
a992 4
  blc[0] = -180.0f;
  blc[1] =  -90.0f;
  trc[0] =  180.0f;
  trc[1] =  +90.0f;
d1076 4
a1079 4
  blc[0] = 0.5f;
  blc[1] = 0.5f;
  trc[0] = (float)naxis[0] + 0.5f;
  trc[1] = (float)naxis[1] + 0.5f;
d1163 4
a1166 4
  blc[0] = 0.5f;
  blc[1] = 0.5f;
  trc[0] = (float)naxis[0] + 0.5f;
  trc[1] = (float)naxis[1] + 0.5f;
d1321 4
a1324 4
  blc[0] = 0.5f;
  blc[1] = 0.5f;
  trc[0] = (float)naxis[0] + 0.5f;
  trc[1] = (float)naxis[1] + 0.5f;
@


8.5
log
@WCSLIB 8.5
@
text
@d2 2
a3 2
  PGSBOX 8.5 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2025, Mark Calabretta
d21 2
a22 2
  http://www.atnf.csiro.au/people/Mark.Calabretta
  $Id: cpgtest.c,v 8.4.1.2 2025/12/06 13:37:20 mcalabre Exp mcalabre $
@


8.5.1.1
log
@WCSLIB 8.5 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 8.5 2025/12/06 13:47:42 mcalabre Exp $
@


8.5.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1997-2026, Mark Calabretta
d21 2
a22 2
  http://www.atnf.csiro.au/computing/software/wcs
  $Id: cpgtest.c,v 8.5.1.1 2025/12/06 14:05:17 mcalabre Exp mcalabre $
@


8.4
log
@WCSLIB 8.4
@
text
@d2 2
a3 2
  PGSBOX 8.4 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2024, Mark Calabretta
d22 1
a22 1
  $Id: cpgtest.c,v 8.3.1.1 2024/05/13 16:35:40 mcalabre Exp mcalabre $
@


8.4.1.1
log
@WCSLIB 8.4 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 8.4 2024/10/28 13:56:18 mcalabre Exp $
@


8.4.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1997-2025, Mark Calabretta
d22 1
a22 1
  $Id: cpgtest.c,v 8.4.1.1 2024/10/28 13:58:42 mcalabre Exp mcalabre $
@


8.3
log
@WCSLIB 8.3
@
text
@d2 1
a2 1
  PGSBOX 8.3 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: cpgtest.c,v 8.2.1.2 2024/04/02 13:43:15 mcalabre Exp mcalabre $
@


8.3.1.1
log
@WCSLIB 8.3 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 8.3 2024/05/13 16:33:01 mcalabre Exp $
@


8.2
log
@WCSLIB 8.2
@
text
@d2 2
a3 2
  PGSBOX 8.2 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2023, Mark Calabretta
d22 1
a22 1
  $Id: cpgtest.c,v 8.1.1.1 2023/07/05 17:15:01 mcalabre Exp mcalabre $
@


8.2.1.1
log
@WCSLIB 8.2 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 8.2 2023/11/16 10:00:31 mcalabre Exp $
@


8.2.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1997-2024, Mark Calabretta
d22 1
a22 1
  $Id: cpgtest.c,v 8.2.1.1 2023/11/16 10:05:59 mcalabre Exp mcalabre $
@


8.1
log
@WCSLIB 8.1
@
text
@d2 1
a2 1
  PGSBOX 8.1 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: cpgtest.c,v 8.0.1.2 2023/07/04 13:00:56 mcalabre Exp mcalabre $
@


8.1.1.1
log
@WCSLIB 8.1 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $
@


8.0
log
@WCSLIB 8.0
@
text
@d2 1
a2 1
  PGSBOX 8.0 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: cpgtest.c,v 7.13.1.2 2023/06/15 04:17:22 mcalabre Exp mcalabre $
d29 3
d35 2
d123 3
d195 1
d260 1
d319 1
d402 1
d525 1
d736 1
d897 1
d973 1
d1058 1
d1136 1
d1260 1
d1303 1
d1370 1
@


8.0.1.1
log
@WCSLIB 8.0 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 8.0 2023/07/01 06:15:05 mcalabre Exp $
@


8.0.1.2
log
@Added calls to nanosleep() to slow down the plots, otherwise they were just
a blur.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 8.0.1.1 2023/07/01 06:22:45 mcalabre Exp mcalabre $
a28 3
// Needed to get nanosleep() from time.h.
#define _POSIX_C_SOURCE 199309L

a31 2
#include <time.h>

a117 3
  // Allow 250ms to view the plot on fast machines.
  struct timespec nano = {(time_t)0, 250000000L};

a186 1
  nanosleep(&nano, 0x0);
a250 1
  nanosleep(&nano, 0x0);
a308 1
  nanosleep(&nano, 0x0);
a390 1
  nanosleep(&nano, 0x0);
a512 1
  nanosleep(&nano, 0x0);
a722 1
  nanosleep(&nano, 0x0);
a882 1
  nanosleep(&nano, 0x0);
a957 1
  nanosleep(&nano, 0x0);
a1041 1
  nanosleep(&nano, 0x0);
a1118 1
  nanosleep(&nano, 0x0);
a1241 1
  nanosleep(&nano, 0x0);
a1283 1
  nanosleep(&nano, 0x0);
a1349 1
  nanosleep(&nano, 0x0);
@


7.13
log
@WCSLIB 7.13
@
text
@d2 2
a3 2
  PGSBOX 7.13 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2022, Mark Calabretta
d22 1
a22 1
  $Id: cpgtest.c,v 7.12.1.1 2022/09/09 05:00:36 mcalabre Exp mcalabre $
@


7.13.1.1
log
@WCSLIB 7.13 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 7.13 2022/10/07 03:43:35 mcalabre Exp $
@


7.13.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1997-2023, Mark Calabretta
d22 1
a22 1
  $Id: cpgtest.c,v 7.13.1.1 2022/10/07 03:45:47 mcalabre Exp mcalabre $
@


7.12
log
@WCSLIB 7.12
@
text
@d2 1
a2 1
  PGSBOX 7.12 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: cpgtest.c,v 7.11.1.1 2022/04/26 06:15:33 mcalabre Exp mcalabre $
@


7.12.1.1
log
@WCSLIB 7.12 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 7.12 2022/09/09 04:57:58 mcalabre Exp $
@


7.11
log
@WCSLIB 7.11
@
text
@d2 1
a2 1
  PGSBOX 7.11 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: cpgtest.c,v 7.10.1.1 2022/04/23 14:26:55 mcalabre Exp mcalabre $
@


7.11.1.1
log
@WCSLIB 7.11 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 7.11 2022/04/26 06:13:52 mcalabre Exp $
@


7.10
log
@WCSLIB 7.10
@
text
@d2 1
a2 1
  PGSBOX 7.10 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: cpgtest.c,v 7.9.1.1 2022/03/25 15:16:40 mcalabre Exp mcalabre $
@


7.10.1.1
log
@WCSLIB 7.10 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 7.10 2022/04/23 14:25:15 mcalabre Exp $
@


7.9
log
@WCSLIB 7.9
@
text
@d2 1
a2 1
  PGSBOX 7.9 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: cpgtest.c,v 7.8.1.1 2022/03/25 06:14:15 mcalabre Exp mcalabre $
@


7.9.1.1
log
@WCSLIB 7.9 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 7.9 2022/03/25 15:14:49 mcalabre Exp $
@


7.8
log
@WCSLIB 7.8
@
text
@d2 1
a2 1
  PGSBOX 7.8 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: cpgtest.c,v 7.7.1.2 2022/03/25 06:06:01 mcalabre Exp mcalabre $
@


7.8.1.1
log
@WCSLIB 7.8 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 7.8 2022/03/25 06:11:50 mcalabre Exp $
@


7.7
log
@WCSLIB 7.7
@
text
@d2 2
a3 2
  PGSBOX 7.7 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2021, Mark Calabretta
d22 1
a22 1
  $Id: cpgtest.c,v 7.6.1.2 2021/07/02 03:26:24 mcalabre Exp mcalabre $
@


7.7.1.1
log
@WCSLIB 7.7 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $
@


7.7.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1997-2022, Mark Calabretta
d22 1
a22 1
  $Id: cpgtest.c,v 7.7.1.1 2021/07/12 06:38:28 mcalabre Exp mcalabre $
@


7.6
log
@WCSLIB 7.6
@
text
@d2 1
a2 1
  PGSBOX 7.6 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: cpgtest.c,v 7.5.1.1 2021/03/20 05:56:42 mcalabre Exp mcalabre $
d51 4
a54 5
  char   devtyp[16], fcode[2][4], idents[3][80], nlcprm[1], opt[2];
  int    c0[7], ci[7], gcode[2], ic, ierr, j, large, naxis[2], nliprm[2];
  float  blc[2], scl, trc[2];
  double cache[257][4], dec0, grid1[9], grid2[9], nldprm[8], rotn, tiklen;
  struct wcsprm wcs;
d58 1
a58 2
  naxis[0] = 512;
  naxis[1] = 512;
d60 2
a61 2
  blc[0] = 0.5f;
  blc[1] = 0.5f;
d65 1
d69 2
a70 2
  j = 16;
  cpgqinf("TYPE", devtyp, &j);
d80 2
a81 1
  large = strcmp(devtyp, "XWINDOW") == 0;
d115 1
d350 1
a350 1
  dec0 = -89.99995;
d552 1
a552 1
  rotn = 30.0*d2r;
d581 1
a581 1
  tiklen = -2.0;
d1200 1
a1200 1
  for (j = 0; j <= ic; j++) {
@


7.6.1.1
log
@WCSLIB 7.6 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 7.6 2021/04/13 12:57:02 mcalabre Exp $
@


7.6.1.2
log
@Converted to C99-style intermingled variable declarations.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 7.6.1.1 2021/04/13 13:00:37 mcalabre Exp mcalabre $
d51 5
a55 4
  // cpgsbox() function arguments.
  char   fcode[2][4], idents[3][80], nlcprm[1], opt[2];
  int    c0[7], ci[7], gcode[2], ic, ierr, nliprm[2];
  double cache[257][4], grid1[9], grid2[9], nldprm[8];
d59 2
a60 1
  int naxis[2] = {512, 512};
d62 2
a63 2
  float blc[2] = {0.5f, 0.5f};
  float trc[2];
a66 1
  char devtyp[16];
d70 2
a71 2
  int nchr = 16;
  cpgqinf("TYPE", devtyp, &nchr);
d81 1
a81 2
  int large = strcmp(devtyp, "XWINDOW") == 0;
  float scl;
a114 1
  struct wcsprm wcs;
d349 1
a349 1
  double dec0 = -89.99995;
d551 1
a551 1
  double rotn = 30.0*d2r;
d580 1
a580 1
  double tiklen = -2.0;
d1199 1
a1199 1
  for (int j = 0; j <= ic; j++) {
@


7.5
log
@WCSLIB 7.5
@
text
@d2 1
a2 1
  PGSBOX 7.5 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: cpgtest.c,v 7.4.1.1 2021/01/31 02:26:24 mcalabre Exp mcalabre $
@


7.5.1.1
log
@WCSLIB 7.5 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 7.5 2021/03/20 05:54:59 mcalabre Exp $
@


7.4
log
@WCSLIB 7.4
@
text
@d2 1
a2 1
  PGSBOX 7.4 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: cpgtest.c,v 7.3.1.4 2021/01/28 12:32:51 mcalabre Exp mcalabre $
@


7.4.1.1
log
@WCSLIB 7.4 development branch.
@
text
@d22 1
a22 1
  $Id: cpgtest.c,v 7.4 2021/01/31 02:24:52 mcalabre Exp $
@


7.3
log
@WCSLIB 7.3
@
text
@d2 2
a3 3

  PGSBOX 7.3 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2020, Mark Calabretta
a19 2
  Direct correspondence concerning PGSBOX to mark@@calabretta.id.au

d22 1
a22 1
  $Id: cpgtest.c,v 7.2.1.1 2020/03/09 07:34:50 mcalabre Exp mcalabre $
d38 1
a38 1
/* Fortran name mangling. */
d58 1
a58 1
  /* Setup. */
d76 1
a76 1
    /* Switch black and white. */
d90 1
a90 1
  /* Yellow. */
d92 1
a92 1
  /* White. */
d94 1
a94 1
  /* Pale blue. */
d96 1
a96 1
  /* Pale red. */
d98 1
a98 1
  /* Grey. */
d100 1
a100 1
  /* Dark green. */
d117 16
a132 16
  /*--------------------------------------------------------------------------
  * Longitude-velocity map; the y-axis is regularly spaced in frequency but is
  * to be labelled as a true relativistic velocity.
  *   - PGSBOX uses subroutine LNGVEL.
  *   - Separable (i.e. orthogonal), non-linear coordinate system.
  *   - Automatic choice of coordinate increments.
  *   - Extraction of a common scaling factor.
  *   - Automatic choice of what edges to label.
  *   - Request for tickmarks (internal) for one coordinate and grid lines
  *     for the other.
  *   - Simple two-colour grid using two calls with deferred labelling on
  *     the first call.
  *   - Degree labelling.
  *   - Suppression of zero arcmin and arcsec fields in sexagesimal degree
  *     format.
  *------------------------------------------------------------------------*/
d136 1
a136 1
  /* Reference pixel coordinates. */
d140 1
a140 1
  /* Reference pixel values. */
d144 1
a144 1
  /* Coordinate increments. */
d148 1
a148 1
  /* Rest frequency. */
d151 1
a151 1
  /* Annotation. */
d159 1
a159 1
  /* Normal size lettering. */
d162 1
a162 1
  /* Yellow tick marks for longitude and grid lines for velocity. */
d169 1
a169 1
  /* Defer labelling. */
d174 1
a174 1
  /* Draw fiducial grid lines in white and do labelling. */
d183 1
a183 1
  /* Draw the frame. */
d188 18
a205 18
  /*--------------------------------------------------------------------------
  * Azimuth-frequency scan; this sort of output might be obtained from an
  * antenna that scans in azimuth with a receiver that scans simultaneously
  * in frequency.
  *   - PGSBOX uses subroutine FSCAN.
  *   - Non-separable (i.e. non-orthogonal) non-linear coordinate system.
  *   - Automatic choice of what edges to label; results in labelling the
  *     bottom, left and right sides of the plot.
  *   - Cyclic labelling.  FSCAN returns the azimuth in the range
  *     0 - 720 degrees but PGSBOX is set to normalize this to two cycles of
  *     0 - 360 degrees.
  *   - Logarithmic labelling.
  *   - Automatic choice of coordinate increments but with request for all
  *     grid lines for the logarithmic coordinate.
  *   - Degree labelling.
  *   - Suppression of common zero arcmin and arcsec fields in sexagesimal
  *     degree format.
  *------------------------------------------------------------------------*/
d209 1
a209 1
  /* Reference pixel coordinates. */
d213 1
a213 1
  /* Reference pixel values. */
d217 1
a217 1
  /* Coordinate increments. */
d221 1
a221 1
  /* Rate of change of NLDPRM[3] with x-pixel. */
d224 1
a224 1
  /* Annotation. */
d232 1
a232 1
  /* Normal size lettering. */
d235 1
a235 1
  /* Draw full grid lines. */
d242 1
a242 1
  /* Setting labden = 9900 forces all logarithmic grid lines to be drawn. */
d247 1
a247 1
  /* Draw the frame. */
d253 11
a263 11
  /*--------------------------------------------------------------------------
  * Z versus time plot.
  *   - PGSBOX uses subroutine PGCRFN.
  *   - Separable (i.e. orthogonal), non-linear coordinate system.
  *   - Use of function PGCRFN for separable axis types.
  *   - Automatic choice of what edges to label; results in labelling the
  *     bottom and left sides of the plot.
  *   - Automatic choice of coordinate increments.
  *   - Logarithmic labelling over many orders of magnitude.
  *   - Single-character annotation on a vertical axis is upright.
  *------------------------------------------------------------------------*/
d267 1
a267 1
  /* Function types. */
d271 1
a271 1
  /* Reference pixel coordinates. */
d275 1
a275 1
  /* Coordinate increments. */
d279 1
a279 1
  /* Reference pixel values. */
d283 1
a283 1
  /* Annotation. */
d291 1
a291 1
  /* Normal size lettering. */
d294 1
a294 1
  /* Draw ticks for the first coordinate, grid lines for the second. */
d305 1
a305 1
  /* Draw the frame. */
d310 20
a329 20
  /*--------------------------------------------------------------------------
  * Simple SIN projection near the south celestial pole.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Discovery of grid lines that do not cross any axis.
  *   - Automatic choice of what edges to label; results in labelling all
  *     sides of the plot.
  *   - Automatic choice of coordinate increments but with request for
  *     increased grid density for each coordinate.
  *   - Double precision accuracy.
  *   - Cyclic coordinates.  PGWCSL returns the right ascension in the range
  *     -180 to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
  *   - Labelling of degrees as time in the range 0 - 24h.
  *   - Suppression of labels that would overlap one another.
  *   - Sexagesimal degree labelling with automatically determined
  *     precision.
  *   - Suppression of common zero minute and second fields in sexagesimal
  *     time format.
  *------------------------------------------------------------------------*/
d336 1
a336 1
  /* Set projection type to SIN. */
d340 1
a340 1
  /* Reference pixel coordinates. */
d344 1
a344 1
  /* Coordinate increments. */
d348 1
a348 1
  /* Spherical coordinate references. */
d353 1
a353 1
  /* Set parameters for an NCP projection. */
d362 1
a362 1
  /* Annotation. */
d370 1
a370 1
  /* Compact lettering. */
d373 1
a373 1
  /* Draw full grid lines. */
d380 2
a381 2
  /* Draw the celestial grid.  The grid density is set for each world */
  /* coordinate by specifying LABDEN = 1224. */
d387 1
a387 1
  /* Draw the frame. */
d392 19
a410 19
  /*-------------------------------------------------------------------------
  * Conic equal area projection.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  *   - Coordinate system undefined in areas of the plot.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Discontinuous grid lines handled by PGWCSL.
  *   - Discovery of grid lines that do not cross any axis.
  *   - Colour control for grid and labelling.
  *   - Reduced size lettering.
  *   - Automatic choice of what edges to label; results in labelling all
  *     sides of the plot.
  *   - Automatic choice of coordinate increments.
  *   - Cyclic coordinates.  PGWCSL returns the longitude in the range -180
  *     to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
  *   - Suppression of labels that would overlap one another.
  *   - Suppression of common zero arcmin and arcsec fields in sexagesimal
  *     degree format.
  *------------------------------------------------------------------------*/
d416 1
a416 1
  /* Set projection type to conic equal-area. */
d420 1
a420 1
  /* Reference pixel coordinates. */
d424 1
a424 1
  /* Coordinate increments. */
d428 1
a428 1
  /* Spherical coordinate references. */
d433 1
a433 1
  /* Middle latitude and offset from standard parallels. */
d442 1
a442 1
  /* Annotation. */
d450 1
a450 1
  /* Reduced size lettering. */
d453 1
a453 1
  /* Draw full grid lines. */
d459 2
a460 2
  /* Use colour to associate grid lines and labels. */
  /* Meridians in red. */
d462 1
a462 1
  /* Parallels in blue. */
d464 1
a464 1
  /* Longitudes in red. */
d466 1
a466 1
  /* Latitudes in blue. */
d468 1
a468 1
  /* Longitude labels in red. */
d470 1
a470 1
  /* Latitude labels in blue. */
d472 1
a472 1
  /* Title in cyan. */
d483 1
a483 1
  /* Draw the celestial grid letting PGSBOX choose the increments. */
d489 1
a489 1
  /* Set parameters to draw the native grid. */
d496 1
a496 1
  /* We just want to delineate the boundary, in green. */
d508 1
a508 1
  /* Draw the frame. */
d514 23
a536 23
  /*--------------------------------------------------------------------------
  * Polyconic projection with colour-coded grid.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  *   - Coordinate system undefined in areas of the plot.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Discontinuous grid lines handled by PGWCSL.
  *   - Colour coded labelling.
  *   - Colour coded grid implemented by the caller.
  *   - Basic management of the axis-crossing table (see code).
  *   - Reduced size lettering.
  *   - Tick marks external to the frame.
  *   - User selection of what edges to label with request for both
  *     coordinates to be labelled on bottom, left and top edges.
  *   - User selection of grid lines to plot.
  *   - Concatenation of annotation at bottom and left; automatically
  *     suppressed at the top since only one coordinate is labelled there.
  *   - Suppression of labels that would overlap one another.
  *   - Degree labelling.
  *   - Labelling of degrees as time in the range -12 - +12h.
  *   - Suppression of common zero minute and second fields in sexagesimal
  *     time format.
  *------------------------------------------------------------------------*/
d542 1
a542 1
  /* Set projection type to polyconic. */
d546 1
a546 1
  /* Reference pixel coordinates. */
d550 1
a550 1
  /* Rotate 30 degrees. */
d557 1
a557 1
  /* Coordinate increments. */
d561 1
a561 1
  /* Spherical coordinate references. */
d566 1
a566 1
  /* Annotation. */
d574 1
a574 1
  /* Reduced size lettering. */
d577 1
a577 1
  /* Draw external (TIKLEN < 0) tick marks every 5 degrees. */
d591 2
a592 2
  /* Resetting the table index to zero causes information about the */
  /* tick marks to be discarded. */
d595 1
a595 1
  /* Draw full grid lines in yellow rather than tick marks. */
d600 1
a600 1
  /* Draw the primary meridian and equator. */
d607 4
a610 4
  /* At this point the axis-crossing table will have entries for the  */
  /* primary meridian and equator.  Labelling was deferred in the     */
  /* previous call, and the table is passed intact on the second call */
  /* to accumulate further axis-crossings.                            */
d612 1
a612 1
  /* Draw 90 degree meridians and poles in white. */
d623 1
a623 1
  /* Draw the first set of 15 degree meridians and parallels in blue. */
d641 1
a641 1
  /* Draw the second set of 15 degree meridians and parallels in red. */
d659 9
a667 9
  /* The axis-crossing table has now accumulated information for all of */
  /* the preceding meridians and parallels but no labels have been      */
  /* produced.  It will acquire information for the the next set of     */
  /* meridians and parallels before being processed by this call to     */
  /* PGSBOX which finally produces the labels.                          */

  /* Draw the 45 degree meridians and parallels in grey and use colour  */
  /* to differentiate grid labels. */
  /* Meridians and parallels in grey. */
d670 1
a670 1
  /* Longitudes tinged red. */
d672 1
a672 1
  /* Latitudes tinged green. */
d674 1
a674 1
  /* Longitude labels tinged red. */
d676 1
a676 1
  /* Latitude labels tinged green. */
d678 1
a678 1
  /* Title in white. */
d691 1
a691 1
  /* Tell PGSBOX what edges to label. */
d702 1
a702 1
  /* Native grid in green (delineates boundary). */
d718 1
a718 1
  /* Draw the frame. */
d724 16
a739 16
  /*--------------------------------------------------------------------------
  * Plate Carree projection.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - Rectangular image.
  *   - Dual coordinate grids.
  *   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Discontinuous grid lines handled by PGWCSL.
  *   - Colour coding of grid and labelling.
  *   - Reduced size lettering.
  *   - Manual labelling control.
  *   - Manual and automatic choice of coordinate increments.
  *   - Cyclic coordinates.  PGWCSL returns the longitude in the range -180
  *     to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
  *   - Suppression of labels that would overlap one another.
  *------------------------------------------------------------------------*/
d751 1
a751 1
  /* Reset viewport for rectangular image. */
d761 1
a761 1
  /* Set projection type to plate carree. */
d765 1
a765 1
  /* Reference pixel coordinates. */
d769 1
a769 1
  /* Linear transformation matrix. */
d776 1
a776 1
  /* Coordinate increments. */
d780 1
a780 1
  /* Set parameters to draw the native grid. */
d784 5
a788 5
  /* The reference pixel was defined so that the native longitude runs   */
  /* from 225 deg to 45 deg and this will cause the grid to be truncated */
  /* at the 180 deg boundary.  However, being a cylindrical projection   */
  /* it is possible to recentre it in longitude.  cylfix() will modify   */
  /* modify CRPIX, CRVAL, and LONPOLE to suit.                           */
d792 1
a792 1
  /* Annotation. */
d800 1
a800 1
  /* Reduced size lettering. */
d803 1
a803 1
  /* Draw full grid lines. */
d807 1
a807 1
  /* Draw native grid in green. */
d809 1
a809 1
  /* Title in cyan. */
d827 1
a827 1
  /* Reset CRPIX previously modified by cylfix(). */
d831 1
a831 1
  /* Galactic reference coordinates. */
d839 1
a839 1
  /* Annotation. */
d847 2
a848 2
  /* Use colour to associate grid lines and labels. */
  /* Meridians in red. */
d850 1
a850 1
  /* Parallels in blue. */
d852 1
a852 1
  /* Longitudes in red. */
d854 1
a854 1
  /* Latitudes in blue. */
d856 1
a856 1
  /* Longitude labels in red. */
d858 1
a858 1
  /* Latitude labels in blue. */
d872 1
a872 1
  /* Draw the celestial grid letting PGSBOX choose the increments. */
d878 1
a878 1
  /* Draw the frame. */
d884 11
a894 11
  /*--------------------------------------------------------------------------
  * Plate Carree projection.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - BLC, TRC unrelated to pixel coordinates.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Poles and 180 meridian projected along edges of the frame.
  *   - Reduced size lettering.
  *   - Manual and automatic choice of coordinate increments.
  *   - Suppression of common zero minute and second fields in sexagesimal
  *     time format.
  *------------------------------------------------------------------------*/
d903 1
a903 1
  /*  Reset viewport for rectangular image. */
d913 1
a913 1
  /* Set projection type to plate carree. */
d917 1
a917 1
  /* Reference pixel coordinates. */
d921 1
a921 1
  /* Coordinate increments. */
d925 1
a925 1
  /* Set parameters to draw the native grid. */
d929 1
a929 1
  /* Annotation. */
d937 1
a937 1
  /* Reduced size lettering. */
d940 1
a940 1
  /* Draw full grid lines. */
d954 1
a954 1
  /* Draw the frame. */
d959 10
a968 10
  /*--------------------------------------------------------------------------
  * Cylindrical perspective projection.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - BLC, TRC unrelated to pixel coordinates.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Reduced size lettering.
  *   - Manual and automatic choice of coordinate increments.
  *   - Suppression of common zero minute and second fields in sexagesimal
  *     time format.
  *------------------------------------------------------------------------*/
d977 1
a977 1
  /*  Reset viewport for rectangular image. */
d987 1
a987 1
  /* Set projection type to cylindrical perspective. */
d991 1
a991 1
  /* Reference pixel coordinates. */
d995 1
a995 1
  /* Coordinate increments. */
d999 1
a999 1
  /* Set parameters to draw the native grid. */
d1004 1
a1004 1
  /* mu and lambda projection parameters. */
d1013 1
a1013 1
  /* Annotation. */
d1021 1
a1021 1
  /* Reduced size lettering. */
d1024 1
a1024 1
  /* Draw full grid lines. */
d1038 1
a1038 1
  /* Draw the frame. */
d1043 9
a1051 9
  /*--------------------------------------------------------------------------
  * Gnomonic projection.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Reduced size lettering.
  *   - Manual and automatic choice of coordinate increments.
  *   - Suppression of common zero minute and second fields in sexagesimal
  *     time format.
  *------------------------------------------------------------------------*/
d1063 1
a1063 1
  /*  Reset viewport for rectangular image. */
d1073 1
a1073 1
  /* Set projection type to gnomonic. */
d1077 1
a1077 1
  /* Reference pixel coordinates. */
d1081 1
a1081 1
  /* Coordinate increments. */
d1085 1
a1085 1
  /* Set parameters to draw the native grid. */
d1090 1
a1090 1
  /* Annotation. */
d1098 1
a1098 1
  /* Reduced size lettering. */
d1101 1
a1101 1
  /* Draw full grid lines. */
d1115 1
a1115 1
  /* Draw the frame. */
d1120 11
a1130 11
  /*--------------------------------------------------------------------------
  * Linear-linear plot with two types of alternative labelling.
  *   - PGSBOX uses subroutine PGCRFN.
  *   - Separable (i.e. orthogonal), linear coordinate system.
  *   - Use of function PGCRFN for separable axis types.
  *   - Alternative labelling and axis annotation.
  *   - Direct manipulation of the axis-crossing table.
  *   - Tick mark and grid line control.
  *   - User selection of what edges to label.
  *   - Automatic choice of coordinate increments.
  *------------------------------------------------------------------------*/
d1149 1
a1149 1
  /* Function types. */
d1153 1
a1153 1
  /* Reference pixel coordinates. */
d1157 1
a1157 1
  /* Coordinate increments. */
d1161 1
a1161 1
  /* Reference pixel values. */
d1165 1
a1165 1
  /* Annotation. */
d1173 1
a1173 1
  /* Reduced size lettering. */
d1176 5
a1180 5
  /* Draw tick marks at the bottom for the first coordinate, grid lines  */
  /* for the second.  Setting GCODE[0] = -1 inhibits information being   */
  /* stored for labels on the top edge while GCODE[1] = 2 causes         */
  /* information to be stored for labels on the right edge even if those */
  /* labels are not actually produced.                                   */
d1187 1
a1187 1
  /* Set LABCTL = 21 to label the bottom and left edges only. */
d1192 7
a1198 7
  /* Information for labels on the right edge was stored in the crossing   */
  /* table on the first call to PGSBOX.  We now want to manipulate it to   */
  /* convert metres to feet.  Note that while it's a simple matter to draw */
  /* alternative sets of tick marks on opposite edges of the frame, as     */
  /* with the two temperature scales, we have the slightly more difficult  */
  /* requirement of labelling grid lines with different values at each     */
  /* end.                                                                  */
d1200 1
a1200 1
    /* Look for entries associated with the right edge of the frame. */
d1202 1
a1202 1
      /* Convert to feet, rounding to the nearest 0.1. */
d1208 1
a1208 1
  /* Annotation for the right edge. */
d1212 2
a1213 2
  /* Set LABCTL = 12000 to label the right edge with the second coordinate */
  /* without redrawing the grid lines. */
d1218 2
a1219 2
  /* The alternative temperature scale in Fahrenheit is to be constructed */
  /* with a new set of tick marks. */
d1223 2
a1224 2
  /* Draw tick marks at the top for the first coordinate, don't redo grid */
  /* lines for the second. */
d1228 1
a1228 1
  /* Annotation for the top edge. */
d1232 2
a1233 2
  /* Set LABCTL = 100 to label the top edge; Set IC = -1 to redetermine */
  /* the coordinate extrema. */
d1238 1
a1238 1
  /* Draw the frame. */
d1243 10
a1252 10
  /*--------------------------------------------------------------------------
  * Calendar axes using subroutine PGLBOX.
  *   - Separable (i.e. orthogonal), linear coordinate system.
  *   - Use of PGLBOX for simple linear axis types.
  *   - Automatic choice of what edges to label; results in labelling the
  *     bottom and left sides of the plot.
  *   - Automatic choice of coordinate increments.
  *   - Calendar date axis labelling.
  *   - Single-character annotation on a vertical axis is upright.
  *------------------------------------------------------------------------*/
d1258 1
a1258 1
  /* Annotation. */
d1266 1
a1266 1
  /* Reduced size lettering. */
d1269 1
a1269 1
  /* Draw tick marks on each axis. */
d1280 1
a1280 1
  /* Draw the frame. */
d1285 9
a1293 9
  /*--------------------------------------------------------------------------
  * Simple linear axes handled by PGWCSL.
  *   - Separable (i.e. orthogonal), linear coordinate system.
  *   - Automatic choice of what edges to label; results in labelling the
  *     bottom and left sides of the plot.
  *   - Automatic choice of coordinate increments.
  *   - Tick marks and labels at the edges of the frame.
  *   - Single-character annotation on a vertical axis is upright.
  *------------------------------------------------------------------------*/
d1310 1
a1310 1
  /* Reference pixel coordinates. */
d1314 1
a1314 1
  /* Coordinate increments. */
d1318 1
a1318 1
  /* Spherical coordinate references. */
d1322 1
a1322 1
  /* Annotation. */
d1330 1
a1330 1
  /* Reduced size lettering. */
d1333 1
a1333 1
  /* Draw full grid lines. */
d1346 1
a1346 1
  /* Draw the frame. */
d1351 1
a1351 1
  /*------------------------------------------------------------------------*/
@


7.3.1.1
log
@WCSLIB 7.3 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 7.3 2020/06/03 03:37:03 mcalabre Exp $
@


7.3.1.2
log
@Switched to C99 style commenting (i.e. using //) within the code.
@
text
@d2 1
d25 1
a25 1
  $Id: cpgtest.c,v 7.3.1.1 2020/06/03 03:38:11 mcalabre Exp mcalabre $
d41 1
a41 1
// Fortran name mangling.
d61 1
a61 1
  // Setup.
d79 1
a79 1
    // Switch black and white.
d93 1
a93 1
  // Yellow.
d95 1
a95 1
  // White.
d97 1
a97 1
  // Pale blue.
d99 1
a99 1
  // Pale red.
d101 1
a101 1
  // Grey.
d103 1
a103 1
  // Dark green.
d120 16
a135 16
  //--------------------------------------------------------------------------
  // Longitude-velocity map; the y-axis is regularly spaced in frequency but
  // is to be labelled as a true relativistic velocity.
  //   - PGSBOX uses subroutine LNGVEL.
  //   - Separable (i.e. orthogonal), non-linear coordinate system.
  //   - Automatic choice of coordinate increments.
  //   - Extraction of a common scaling factor.
  //   - Automatic choice of what edges to label.
  //   - Request for tickmarks (internal) for one coordinate and grid lines
  //     for the other.
  //   - Simple two-colour grid using two calls with deferred labelling on
  //     the first call.
  //   - Degree labelling.
  //   - Suppression of zero arcmin and arcsec fields in sexagesimal degree
  //     format.
  //--------------------------------------------------------------------------
d139 1
a139 1
  // Reference pixel coordinates.
d143 1
a143 1
  // Reference pixel values.
d147 1
a147 1
  // Coordinate increments.
d151 1
a151 1
  // Rest frequency.
d154 1
a154 1
  // Annotation.
d162 1
a162 1
  // Normal size lettering.
d165 1
a165 1
  // Yellow tick marks for longitude and grid lines for velocity.
d172 1
a172 1
  // Defer labelling.
d177 1
a177 1
  // Draw fiducial grid lines in white and do labelling.
d186 1
a186 1
  // Draw the frame.
d191 18
a208 18
  //--------------------------------------------------------------------------
  // Azimuth-frequency scan; this sort of output might be obtained from an
  // antenna that scans in azimuth with a receiver that scans simultaneously
  // in frequency.
  //   - PGSBOX uses subroutine FSCAN.
  //   - Non-separable (i.e. non-orthogonal) non-linear coordinate system.
  //   - Automatic choice of what edges to label; results in labelling the
  //     bottom, left and right sides of the plot.
  //   - Cyclic labelling.  FSCAN returns the azimuth in the range
  //     0 - 720 degrees but PGSBOX is set to normalize this to two cycles of
  //     0 - 360 degrees.
  //   - Logarithmic labelling.
  //   - Automatic choice of coordinate increments but with request for all
  //     grid lines for the logarithmic coordinate.
  //   - Degree labelling.
  //   - Suppression of common zero arcmin and arcsec fields in sexagesimal
  //     degree format.
  //--------------------------------------------------------------------------
d212 1
a212 1
  // Reference pixel coordinates.
d216 1
a216 1
  // Reference pixel values.
d220 1
a220 1
  // Coordinate increments.
d224 1
a224 1
  // Rate of change of NLDPRM[3] with x-pixel.
d227 1
a227 1
  // Annotation.
d235 1
a235 1
  // Normal size lettering.
d238 1
a238 1
  // Draw full grid lines.
d245 1
a245 1
  // Setting labden = 9900 forces all logarithmic grid lines to be drawn.
d250 1
a250 1
  // Draw the frame.
d256 11
a266 11
  //--------------------------------------------------------------------------
  // Z versus time plot.
  //   - PGSBOX uses subroutine PGCRFN.
  //   - Separable (i.e. orthogonal), non-linear coordinate system.
  //   - Use of function PGCRFN for separable axis types.
  //   - Automatic choice of what edges to label; results in labelling the
  //     bottom and left sides of the plot.
  //   - Automatic choice of coordinate increments.
  //   - Logarithmic labelling over many orders of magnitude.
  //   - Single-character annotation on a vertical axis is upright.
  //--------------------------------------------------------------------------
d270 1
a270 1
  // Function types.
d274 1
a274 1
  // Reference pixel coordinates.
d278 1
a278 1
  // Coordinate increments.
d282 1
a282 1
  // Reference pixel values.
d286 1
a286 1
  // Annotation.
d294 1
a294 1
  // Normal size lettering.
d297 1
a297 1
  // Draw ticks for the first coordinate, grid lines for the second.
d308 1
a308 1
  // Draw the frame.
d313 20
a332 20
  //--------------------------------------------------------------------------
  // Simple SIN projection near the south celestial pole.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Discovery of grid lines that do not cross any axis.
  //   - Automatic choice of what edges to label; results in labelling all
  //     sides of the plot.
  //   - Automatic choice of coordinate increments but with request for
  //     increased grid density for each coordinate.
  //   - Double precision accuracy.
  //   - Cyclic coordinates.  PGWCSL returns the right ascension in the range
  //     -180 to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
  //   - Labelling of degrees as time in the range 0 - 24h.
  //   - Suppression of labels that would overlap one another.
  //   - Sexagesimal degree labelling with automatically determined
  //     precision.
  //   - Suppression of common zero minute and second fields in sexagesimal
  //     time format.
  //--------------------------------------------------------------------------
d339 1
a339 1
  // Set projection type to SIN.
d343 1
a343 1
  // Reference pixel coordinates.
d347 1
a347 1
  // Coordinate increments.
d351 1
a351 1
  // Spherical coordinate references.
d356 1
a356 1
  // Set parameters for an NCP projection.
d365 1
a365 1
  // Annotation.
d373 1
a373 1
  // Compact lettering.
d376 1
a376 1
  // Draw full grid lines.
d383 2
a384 2
  // Draw the celestial grid.  The grid density is set for each world
  // coordinate by specifying LABDEN = 1224.
d390 1
a390 1
  // Draw the frame.
d395 19
a413 19
  //-------------------------------------------------------------------------
  // Conic equal area projection.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  //   - Coordinate system undefined in areas of the plot.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Discontinuous grid lines handled by PGWCSL.
  //   - Discovery of grid lines that do not cross any axis.
  //   - Colour control for grid and labelling.
  //   - Reduced size lettering.
  //   - Automatic choice of what edges to label; results in labelling all
  //     sides of the plot.
  //   - Automatic choice of coordinate increments.
  //   - Cyclic coordinates.  PGWCSL returns the longitude in the range -180
  //     to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
  //   - Suppression of labels that would overlap one another.
  //   - Suppression of common zero arcmin and arcsec fields in sexagesimal
  //     degree format.
  //--------------------------------------------------------------------------
d419 1
a419 1
  // Set projection type to conic equal-area.
d423 1
a423 1
  // Reference pixel coordinates.
d427 1
a427 1
  // Coordinate increments.
d431 1
a431 1
  // Spherical coordinate references.
d436 1
a436 1
  // Middle latitude and offset from standard parallels.
d445 1
a445 1
  // Annotation.
d453 1
a453 1
  // Reduced size lettering.
d456 1
a456 1
  // Draw full grid lines.
d462 2
a463 2
  // Use colour to associate grid lines and labels.
  // Meridians in red.
d465 1
a465 1
  // Parallels in blue.
d467 1
a467 1
  // Longitudes in red.
d469 1
a469 1
  // Latitudes in blue.
d471 1
a471 1
  // Longitude labels in red.
d473 1
a473 1
  // Latitude labels in blue.
d475 1
a475 1
  // Title in cyan.
d486 1
a486 1
  // Draw the celestial grid letting PGSBOX choose the increments.
d492 1
a492 1
  // Set parameters to draw the native grid.
d499 1
a499 1
  // We just want to delineate the boundary, in green.
d511 1
a511 1
  // Draw the frame.
d517 23
a539 23
  //--------------------------------------------------------------------------
  // Polyconic projection with colour-coded grid.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  //   - Coordinate system undefined in areas of the plot.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Discontinuous grid lines handled by PGWCSL.
  //   - Colour coded labelling.
  //   - Colour coded grid implemented by the caller.
  //   - Basic management of the axis-crossing table (see code).
  //   - Reduced size lettering.
  //   - Tick marks external to the frame.
  //   - User selection of what edges to label with request for both
  //     coordinates to be labelled on bottom, left and top edges.
  //   - User selection of grid lines to plot.
  //   - Concatenation of annotation at bottom and left; automatically
  //     suppressed at the top since only one coordinate is labelled there.
  //   - Suppression of labels that would overlap one another.
  //   - Degree labelling.
  //   - Labelling of degrees as time in the range -12 - +12h.
  //   - Suppression of common zero minute and second fields in sexagesimal
  //     time format.
  //--------------------------------------------------------------------------
d545 1
a545 1
  // Set projection type to polyconic.
d549 1
a549 1
  // Reference pixel coordinates.
d553 1
a553 1
  // Rotate 30 degrees.
d560 1
a560 1
  // Coordinate increments.
d564 1
a564 1
  // Spherical coordinate references.
d569 1
a569 1
  // Annotation.
d577 1
a577 1
  // Reduced size lettering.
d580 1
a580 1
  // Draw external (TIKLEN < 0) tick marks every 5 degrees.
d594 2
a595 2
  // Resetting the table index to zero causes information about the
  // tick marks to be discarded.
d598 1
a598 1
  // Draw full grid lines in yellow rather than tick marks.
d603 1
a603 1
  // Draw the primary meridian and equator.
d610 4
a613 4
  // At this point the axis-crossing table will have entries for the
  // primary meridian and equator.  Labelling was deferred in the
  // previous call, and the table is passed intact on the second call
  // to accumulate further axis-crossings.
d615 1
a615 1
  // Draw 90 degree meridians and poles in white.
d626 1
a626 1
  // Draw the first set of 15 degree meridians and parallels in blue.
d644 1
a644 1
  // Draw the second set of 15 degree meridians and parallels in red.
d662 9
a670 9
  // The axis-crossing table has now accumulated information for all of
  // the preceding meridians and parallels but no labels have been
  // produced.  It will acquire information for the the next set of
  // meridians and parallels before being processed by this call to
  // PGSBOX which finally produces the labels.

  // Draw the 45 degree meridians and parallels in grey and use colour
  // to differentiate grid labels.
  // Meridians and parallels in grey.
d673 1
a673 1
  // Longitudes tinged red.
d675 1
a675 1
  // Latitudes tinged green.
d677 1
a677 1
  // Longitude labels tinged red.
d679 1
a679 1
  // Latitude labels tinged green.
d681 1
a681 1
  // Title in white.
d694 1
a694 1
  // Tell PGSBOX what edges to label.
d705 1
a705 1
  // Native grid in green (delineates boundary).
d721 1
a721 1
  // Draw the frame.
d727 16
a742 16
  //--------------------------------------------------------------------------
  // Plate Carree projection.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - Rectangular image.
  //   - Dual coordinate grids.
  //   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Discontinuous grid lines handled by PGWCSL.
  //   - Colour coding of grid and labelling.
  //   - Reduced size lettering.
  //   - Manual labelling control.
  //   - Manual and automatic choice of coordinate increments.
  //   - Cyclic coordinates.  PGWCSL returns the longitude in the range -180
  //     to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
  //   - Suppression of labels that would overlap one another.
  //--------------------------------------------------------------------------
d754 1
a754 1
  // Reset viewport for rectangular image.
d764 1
a764 1
  // Set projection type to plate carree.
d768 1
a768 1
  // Reference pixel coordinates.
d772 1
a772 1
  // Linear transformation matrix.
d779 1
a779 1
  // Coordinate increments.
d783 1
a783 1
  // Set parameters to draw the native grid.
d787 5
a791 5
  // The reference pixel was defined so that the native longitude runs
  // from 225 deg to 45 deg and this will cause the grid to be truncated
  // at the 180 deg boundary.  However, being a cylindrical projection
  // it is possible to recentre it in longitude.  cylfix() will modify
  // modify CRPIX, CRVAL, and LONPOLE to suit.
d795 1
a795 1
  // Annotation.
d803 1
a803 1
  // Reduced size lettering.
d806 1
a806 1
  // Draw full grid lines.
d810 1
a810 1
  // Draw native grid in green.
d812 1
a812 1
  // Title in cyan.
d830 1
a830 1
  // Reset CRPIX previously modified by cylfix().
d834 1
a834 1
  // Galactic reference coordinates.
d842 1
a842 1
  // Annotation.
d850 2
a851 2
  // Use colour to associate grid lines and labels.
  // Meridians in red.
d853 1
a853 1
  // Parallels in blue.
d855 1
a855 1
  // Longitudes in red.
d857 1
a857 1
  // Latitudes in blue.
d859 1
a859 1
  // Longitude labels in red.
d861 1
a861 1
  // Latitude labels in blue.
d875 1
a875 1
  // Draw the celestial grid letting PGSBOX choose the increments.
d881 1
a881 1
  // Draw the frame.
d887 11
a897 11
  //--------------------------------------------------------------------------
  // Plate Carree projection.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - BLC, TRC unrelated to pixel coordinates.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Poles and 180 meridian projected along edges of the frame.
  //   - Reduced size lettering.
  //   - Manual and automatic choice of coordinate increments.
  //   - Suppression of common zero minute and second fields in sexagesimal
  //     time format.
  //--------------------------------------------------------------------------
d906 1
a906 1
  //  Reset viewport for rectangular image.
d916 1
a916 1
  // Set projection type to plate carree.
d920 1
a920 1
  // Reference pixel coordinates.
d924 1
a924 1
  // Coordinate increments.
d928 1
a928 1
  // Set parameters to draw the native grid.
d932 1
a932 1
  // Annotation.
d940 1
a940 1
  // Reduced size lettering.
d943 1
a943 1
  // Draw full grid lines.
d957 1
a957 1
  // Draw the frame.
d962 10
a971 10
  //--------------------------------------------------------------------------
  // Cylindrical perspective projection.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - BLC, TRC unrelated to pixel coordinates.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Reduced size lettering.
  //   - Manual and automatic choice of coordinate increments.
  //   - Suppression of common zero minute and second fields in sexagesimal
  //     time format.
  //--------------------------------------------------------------------------
d980 1
a980 1
  //  Reset viewport for rectangular image.
d990 1
a990 1
  // Set projection type to cylindrical perspective.
d994 1
a994 1
  // Reference pixel coordinates.
d998 1
a998 1
  // Coordinate increments.
d1002 1
a1002 1
  // Set parameters to draw the native grid.
d1007 1
a1007 1
  // mu and lambda projection parameters.
d1016 1
a1016 1
  // Annotation.
d1024 1
a1024 1
  // Reduced size lettering.
d1027 1
a1027 1
  // Draw full grid lines.
d1041 1
a1041 1
  // Draw the frame.
d1046 9
a1054 9
  //--------------------------------------------------------------------------
  // Gnomonic projection.
  //   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  //   - Demonstrate parameter definition for PGWCSL.
  //   - Reduced size lettering.
  //   - Manual and automatic choice of coordinate increments.
  //   - Suppression of common zero minute and second fields in sexagesimal
  //     time format.
  //--------------------------------------------------------------------------
d1066 1
a1066 1
  //  Reset viewport for rectangular image.
d1076 1
a1076 1
  // Set projection type to gnomonic.
d1080 1
a1080 1
  // Reference pixel coordinates.
d1084 1
a1084 1
  // Coordinate increments.
d1088 1
a1088 1
  // Set parameters to draw the native grid.
d1093 1
a1093 1
  // Annotation.
d1101 1
a1101 1
  // Reduced size lettering.
d1104 1
a1104 1
  // Draw full grid lines.
d1118 1
a1118 1
  // Draw the frame.
d1123 11
a1133 11
  //--------------------------------------------------------------------------
  // Linear-linear plot with two types of alternative labelling.
  //   - PGSBOX uses subroutine PGCRFN.
  //   - Separable (i.e. orthogonal), linear coordinate system.
  //   - Use of function PGCRFN for separable axis types.
  //   - Alternative labelling and axis annotation.
  //   - Direct manipulation of the axis-crossing table.
  //   - Tick mark and grid line control.
  //   - User selection of what edges to label.
  //   - Automatic choice of coordinate increments.
  //--------------------------------------------------------------------------
d1152 1
a1152 1
  // Function types.
d1156 1
a1156 1
  // Reference pixel coordinates.
d1160 1
a1160 1
  // Coordinate increments.
d1164 1
a1164 1
  // Reference pixel values.
d1168 1
a1168 1
  // Annotation.
d1176 1
a1176 1
  // Reduced size lettering.
d1179 5
a1183 5
  // Draw tick marks at the bottom for the first coordinate, grid lines
  // for the second.  Setting GCODE[0] = -1 inhibits information being
  // stored for labels on the top edge while GCODE[1] = 2 causes
  // information to be stored for labels on the right edge even if those
  // labels are not actually produced.
d1190 1
a1190 1
  // Set LABCTL = 21 to label the bottom and left edges only.
d1195 7
a1201 7
  // Information for labels on the right edge was stored in the crossing
  // table on the first call to PGSBOX.  We now want to manipulate it to
  // convert metres to feet.  Note that while it's a simple matter to draw
  // alternative sets of tick marks on opposite edges of the frame, as
  // with the two temperature scales, we have the slightly more difficult
  // requirement of labelling grid lines with different values at each
  // end.
d1203 1
a1203 1
    // Look for entries associated with the right edge of the frame.
d1205 1
a1205 1
      // Convert to feet, rounding to the nearest 0.1.
d1211 1
a1211 1
  // Annotation for the right edge.
d1215 2
a1216 2
  // Set LABCTL = 12000 to label the right edge with the second coordinate
  // without redrawing the grid lines.
d1221 2
a1222 2
  // The alternative temperature scale in Fahrenheit is to be constructed
  // with a new set of tick marks.
d1226 2
a1227 2
  // Draw tick marks at the top for the first coordinate, don't redo grid
  // lines for the second.
d1231 1
a1231 1
  // Annotation for the top edge.
d1235 2
a1236 2
  // Set LABCTL = 100 to label the top edge; Set IC = -1 to redetermine
  // the coordinate extrema.
d1241 1
a1241 1
  // Draw the frame.
d1246 10
a1255 10
  //--------------------------------------------------------------------------
  // Calendar axes using subroutine PGLBOX.
  //   - Separable (i.e. orthogonal), linear coordinate system.
  //   - Use of PGLBOX for simple linear axis types.
  //   - Automatic choice of what edges to label; results in labelling the
  //     bottom and left sides of the plot.
  //   - Automatic choice of coordinate increments.
  //   - Calendar date axis labelling.
  //   - Single-character annotation on a vertical axis is upright.
  //--------------------------------------------------------------------------
d1261 1
a1261 1
  // Annotation.
d1269 1
a1269 1
  // Reduced size lettering.
d1272 1
a1272 1
  // Draw tick marks on each axis.
d1283 1
a1283 1
  // Draw the frame.
d1288 9
a1296 9
  //--------------------------------------------------------------------------
  // Simple linear axes handled by PGWCSL.
  //   - Separable (i.e. orthogonal), linear coordinate system.
  //   - Automatic choice of what edges to label; results in labelling the
  //     bottom and left sides of the plot.
  //   - Automatic choice of coordinate increments.
  //   - Tick marks and labels at the edges of the frame.
  //   - Single-character annotation on a vertical axis is upright.
  //--------------------------------------------------------------------------
d1313 1
a1313 1
  // Reference pixel coordinates.
d1317 1
a1317 1
  // Coordinate increments.
d1321 1
a1321 1
  // Spherical coordinate references.
d1325 1
a1325 1
  // Annotation.
d1333 1
a1333 1
  // Reduced size lettering.
d1336 1
a1336 1
  // Draw full grid lines.
d1349 1
a1349 1
  // Draw the frame.
d1354 1
a1354 1
  //--------------------------------------------------------------------------
@


7.3.1.3
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1997-2021, Mark Calabretta
d24 1
a24 1
  $Id: cpgtest.c,v 7.3.1.2 2020/08/17 11:24:44 mcalabre Exp mcalabre $
@


7.3.1.4
log
@Removed my email address from the copyright notice.
@
text
@d20 2
d24 1
a24 1
  $Id: cpgtest.c,v 7.3.1.3 2021/01/19 14:12:19 mcalabre Exp mcalabre $
@


7.2
log
@WCSLIB 7.2
@
text
@d3 1
a3 1
  PGSBOX 7.2 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 7.1.1.1 2019/12/31 13:28:19 mcalabre Exp mcalabre $
@


7.2.1.1
log
@WCSLIB 7.2 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 7.2 2020/03/09 07:31:24 mcalabre Exp $
@


7.1
log
@WCSLIB 7.1
@
text
@d3 1
a3 1
  PGSBOX 7.1 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 6.4.1.3 2019/12/31 03:29:47 mcalabre Exp mcalabre $
@


7.1.1.1
log
@WCSLIB 7.1 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 7.1 2019/12/31 13:25:20 mcalabre Exp $
@


6.4
log
@WCSLIB 6.4
@
text
@d3 2
a4 2
  PGSBOX 6.4 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2019, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 6.3.1.1 2019/07/12 07:34:37 mcalabre Exp mcalabre $
d271 2
a272 2
  strncpy(fcode[0], "Lin ", 4);
  strncpy(fcode[1], "Log ", 4);
d1153 2
a1154 2
  strncpy(fcode[0], "Lin ", 4);
  strncpy(fcode[1], "Lin ", 4);
@


6.4.1.1
log
@WCSLIB 6.4 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 6.4 2019/08/15 09:30:18 mcalabre Exp $
@


6.4.1.2
log
@Consequent on warnings from gcc 9.2.0 with -Wstringop-truncation (via -Wall),
replaced use of strncpy() with memcpy().
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 6.4.1.1 2019/08/15 09:31:29 mcalabre Exp mcalabre $
d271 2
a272 2
  memcpy(fcode[0], "Lin ", 4);
  memcpy(fcode[1], "Log ", 4);
d1153 2
a1154 2
  memcpy(fcode[0], "Lin ", 4);
  memcpy(fcode[1], "Lin ", 4);
@


6.4.1.3
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2020, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 6.4.1.2 2019/12/03 06:15:29 mcalabre Exp mcalabre $
@


6.3
log
@WCSLIB 6.3
@
text
@d3 1
a3 1
  PGSBOX 6.3 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 6.2.1.2 2019/05/10 02:13:12 mcalabre Exp mcalabre $
@


6.3.1.1
log
@WCSLIB 6.3 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 6.3 2019/07/12 07:33:40 mcalabre Exp $
@


6.2
log
@WCSLIB 6.2
@
text
@d3 2
a4 2
  PGSBOX 6.2 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2018, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 6.1.1.1 2018/10/19 08:36:15 mcalabre Exp mcalabre $
@


6.2.1.1
log
@WCSLIB 6.2 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 6.2 2018/10/20 10:03:14 mcalabre Exp $
@


6.2.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2019, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 6.2.1.1 2018/10/20 10:04:15 mcalabre Exp mcalabre $
@


6.1
log
@WCSLIB 6.1
@
text
@d3 1
a3 1
  PGSBOX 6.1 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.20.1.1 2018/10/05 05:33:33 mcalabre Exp mcalabre $
@


6.1.1.1
log
@WCSLIB 6.1 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 6.1 2018/10/19 08:35:17 mcalabre Exp $
@


5.20
log
@WCSLIB 5.20
@
text
@d3 1
a3 1
  PGSBOX 5.20 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.19.1.1 2018/07/26 15:41:42 mcalabre Exp mcalabre $
@


5.20.1.1
log
@WCSLIB 5.20 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.20 2018/10/05 05:32:42 mcalabre Exp $
@


5.19
log
@WCSLIB 5.19
@
text
@d3 1
a3 1
  PGSBOX 5.19 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.18.1.2 2018/07/25 10:16:09 mcalabre Exp mcalabre $
@


5.19.1.1
log
@WCSLIB 5.19 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.19 2018/07/26 15:37:05 mcalabre Exp $
@


5.18
log
@WCSLIB 5.18
@
text
@d3 1
a3 1
  PGSBOX 5.18 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.17.1.2 2018/01/10 08:27:33 mcalabre Exp mcalabre $
d55 1
a55 2
  int    c0[7], ci[7], gcode[2], ic, ierr, j, large, naxis[2], nliprm[2],
         status;
d337 1
a337 1
  status = wcsini(1, 2, &wcs);
d417 1
a417 1
  status = wcsini(1, 2, &wcs);
d497 1
a497 1
  status = wcsset(&wcs);
d543 1
a543 1
  status = wcsini(1, 2, &wcs);
d714 1
a714 1
  status = wcsset(&wcs);
d762 1
a762 1
  status = wcsini(1, 2, &wcs);
d793 1
a793 1
  status = cylfix(naxis, &wcs);
d838 1
a838 1
  status = wcsset(&wcs);
d840 1
a840 1
  status = cylfix(naxis, &wcs);
d914 1
a914 1
  status = wcsini(1, 2, &wcs);
d988 1
a988 1
  status = wcsini(1, 2, &wcs);
d1074 1
a1074 1
  status = wcsini(1, 2, &wcs);
d1308 1
a1308 1
  status = wcsini(1, 2, &wcs);
@


5.18.1.1
log
@WCSLIB 5.18 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.18 2018/01/10 08:32:14 mcalabre Exp $
@


5.18.1.2
log
@Discard the return value from wcsini(), wcsset(), and cylfix() to avert
warnings from gcc 8.1.0 about ‘status’ being set but not used
(-Wunused-but-set-variable).
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.18.1.1 2018/01/10 08:33:04 mcalabre Exp mcalabre $
d55 2
a56 1
  int    c0[7], ci[7], gcode[2], ic, ierr, j, large, naxis[2], nliprm[2];
d338 1
a338 1
  wcsini(1, 2, &wcs);
d418 1
a418 1
  wcsini(1, 2, &wcs);
d498 1
a498 1
  wcsset(&wcs);
d544 1
a544 1
  wcsini(1, 2, &wcs);
d715 1
a715 1
  wcsset(&wcs);
d763 1
a763 1
  wcsini(1, 2, &wcs);
d794 1
a794 1
  cylfix(naxis, &wcs);
d839 1
a839 1
  wcsset(&wcs);
d841 1
a841 1
  cylfix(naxis, &wcs);
d915 1
a915 1
  wcsini(1, 2, &wcs);
d989 1
a989 1
  wcsini(1, 2, &wcs);
d1075 1
a1075 1
  wcsini(1, 2, &wcs);
d1309 1
a1309 1
  wcsini(1, 2, &wcs);
@


5.17
log
@WCSLIB 5.17
@
text
@d3 2
a4 2
  PGSBOX 5.17 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2017, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 5.16.1.1 2017/01/15 04:29:04 mcalabre Exp mcalabre $
@


5.17.1.1
log
@WCSLIB 5.17 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.17 2017/09/18 08:44:25 mcalabre Exp $
@


5.17.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2018, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 5.17.1.1 2017/09/18 08:46:01 mcalabre Exp mcalabre $
@


5.16
log
@WCSLIB 5.16
@
text
@d3 1
a3 1
  PGSBOX 5.16 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.15.1.2 2017/01/15 04:08:24 mcalabre Exp mcalabre $
@


5.16.1.1
log
@WCSLIB 5.16 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.16 2017/01/15 04:25:03 mcalabre Exp $
@


5.15
log
@WCSLIB 5.15
@
text
@d3 2
a4 2
  PGSBOX 5.15 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2016, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 5.14.1.1 2016/02/07 10:52:48 mcalabre Exp mcalabre $
@


5.15.1.1
log
@WCSLIB 5.15 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.15 2016/04/05 12:55:13 mcalabre Exp $
@


5.15.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2017, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 5.15.1.1 2016/04/05 12:58:39 mcalabre Exp mcalabre $
@


5.14
log
@WCSLIB 5.14
@
text
@d3 1
a3 1
  PGSBOX 5.14 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.13.1.1 2016/01/26 08:54:36 mcalabre Exp mcalabre $
@


5.14.1.1
log
@WCSLIB 5.14 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.14 2016/02/07 10:49:33 mcalabre Exp $
@


5.13
log
@WCSLIB 5.13
@
text
@d3 1
a3 1
  PGSBOX 5.13 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.12.1.2 2016/01/25 05:22:41 mcalabre Exp mcalabre $
@


5.13.1.1
log
@WCSLIB 5.13 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.13 2016/01/26 08:51:16 mcalabre Exp $
@


5.12
log
@WCSLIB 5.12
@
text
@d3 2
a4 2
  PGSBOX 5.12 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2015, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 5.11.1.1 2015/10/18 09:16:31 mcalabre Exp mcalabre $
@


5.12.1.1
log
@WCSLIB 5.12 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.12 2015/11/15 02:13:03 mcalabre Exp $
@


5.12.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2016, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 5.12.1.1 2015/11/15 02:16:18 mcalabre Exp mcalabre $
@


5.11
log
@WCSLIB 5.11
@
text
@d3 1
a3 1
  PGSBOX 5.11 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.10.1.1 2015/10/09 08:22:40 mcalabre Exp mcalabre $
@


5.11.1.1
log
@WCSLIB 5.11 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.11 2015/10/18 09:13:08 mcalabre Exp $
@


5.10
log
@WCSLIB 5.10
@
text
@d3 1
a3 1
  PGSBOX 5.10 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.9.1.1 2015/07/21 09:28:12 mcalabre Exp mcalabre $
@


5.10.1.1
log
@WCSLIB 5.10 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.10 2015/10/09 08:19:18 mcalabre Exp $
@


5.9
log
@WCSLIB 5.9
@
text
@d3 1
a3 1
  PGSBOX 5.9 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.8.1.1 2015/07/08 11:07:22 mcalabre Exp mcalabre $
@


5.9.1.1
log
@WCSLIB 5.9 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.9 2015/07/21 09:20:04 mcalabre Exp $
@


5.8
log
@WCSLIB 5.8
@
text
@d3 1
a3 1
  PGSBOX 5.8 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.7.1.1 2015/06/29 02:47:27 mcalabre Exp mcalabre $
@


5.8.1.1
log
@WCSLIB 5.8 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.8 2015/07/08 11:04:03 mcalabre Exp $
@


5.7
log
@WCSLIB 5.7
@
text
@d3 1
a3 1
  PGSBOX 5.7 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.6.1.1 2015/06/14 07:14:48 mcalabre Exp mcalabre $
@


5.7.1.1
log
@WCSLIB 5.7 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.7 2015/06/29 02:44:19 mcalabre Exp $
@


5.6
log
@WCSLIB 5.6
@
text
@d3 1
a3 1
  PGSBOX 5.6 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.5.1.1 2015/05/05 13:21:04 mcalabre Exp mcalabre $
@


5.6.1.1
log
@WCSLIB 5.6 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.6 2015/06/14 07:11:26 mcalabre Exp $
@


5.5
log
@WCSLIB 5.5
@
text
@d3 1
a3 1
  PGSBOX 5.5 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.4.1.1 2015/04/21 14:44:32 mcalabre Exp mcalabre $
@


5.5.1.1
log
@WCSLIB 5.5 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.5 2015/05/05 13:16:34 mcalabre Exp $
@


5.4
log
@WCSLIB 5.4
@
text
@d3 1
a3 1
  PGSBOX 5.4 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.3.1.1 2015/04/21 02:54:06 mcalabre Exp mcalabre $
@


5.4.1.1
log
@WCSLIB 5.4 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.4 2015/04/21 14:41:08 mcalabre Exp $
@


5.3
log
@WCSLIB 5.3
@
text
@d3 1
a3 1
  PGSBOX 5.3 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.2.1.1 2015/04/15 12:39:18 mcalabre Exp mcalabre $
@


5.3.1.1
log
@WCSLIB 5.3 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.3 2015/04/21 02:50:54 mcalabre Exp $
@


5.2
log
@WCSLIB 5.2
@
text
@d3 1
a3 1
  PGSBOX 5.2 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.1.1.1 2015/04/07 11:01:13 mcalabre Exp mcalabre $
@


5.2.1.1
log
@WCSLIB 5.2 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.2 2015/04/15 12:35:10 mcalabre Exp $
@


5.1
log
@WCSLIB 5.1
@
text
@d3 1
a3 1
  PGSBOX 5.1 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 5.0.1.1 2015/04/05 12:28:04 mcalabre Exp mcalabre $
@


5.1.1.1
log
@WCSLIB 5.1 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.1 2015/04/07 10:56:39 mcalabre Exp $
@


5.0
log
@WCSLIB 5.0
@
text
@d3 1
a3 1
  PGSBOX 5.0 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 4.25.1.2 2015/01/06 01:03:14 mcalabre Exp mcalabre $
@


5.0.1.1
log
@WCSLIB 5.0 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 5.0 2015/04/05 12:25:03 mcalabre Exp $
@


4.25
log
@WCSLIB 4.25
@
text
@d3 2
a4 2
  PGSBOX 4.25 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2014, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 4.24.1.1 2014/09/18 15:28:12 mcalabre Exp mcalabre $
@


4.25.1.1
log
@WCSLIB 4.25 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 4.25 2014/12/14 14:29:38 mcalabre Exp $
@


4.25.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2015, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 4.25.1.1 2014/12/14 14:32:48 mcalabre Exp mcalabre $
@


4.24
log
@WCSLIB 4.24
@
text
@d3 1
a3 1
  PGSBOX 4.24 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 4.23.1.1 2014/05/13 05:53:52 mcalabre Exp mcalabre $
@


4.24.1.1
log
@WCSLIB 4.24 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 4.24 2014/09/18 15:25:02 mcalabre Exp $
@


4.23
log
@WCSLIB 4.23
@
text
@d3 1
a3 1
  PGSBOX 4.23 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 4.22.1.1 2014/04/12 15:06:34 mcalabre Exp mcalabre $
@


4.23.1.1
log
@WCSLIB 4.23 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 4.23 2014/05/13 05:50:53 mcalabre Exp $
@


4.22
log
@WCSLIB 4.22
@
text
@d3 1
a3 1
  PGSBOX 4.22 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 4.21.1.1 2014/03/24 05:15:31 mcalabre Exp mcalabre $
@


4.22.1.1
log
@WCSLIB 4.22 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 4.22 2014/04/12 15:03:54 mcalabre Exp $
@


4.21
log
@WCSLIB 4.21
@
text
@d3 1
a3 1
  PGSBOX 4.21 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 4.20.1.2 2014/03/21 06:45:26 mcalabre Exp mcalabre $
@


4.21.1.1
log
@WCSLIB 4.21 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 4.21 2014/03/24 05:12:29 mcalabre Exp $
@


4.20
log
@WCSLIB 4.20
@
text
@d3 2
a4 2
  PGSBOX 4.20 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2013, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 4.19.1.1 2013/09/29 14:20:41 mcalabre Exp mcalabre $
@


4.20.1.1
log
@WCSLIB 4.20 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 4.20 2013/12/18 05:42:51 mcalabre Exp $
@


4.20.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2014, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 4.20.1.1 2013/12/18 05:46:57 mcalabre Exp mcalabre $
@


4.19
log
@WCSLIB 4.19
@
text
@d3 1
a3 1
  PGSBOX 4.19 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 4.18.1.1 2013/07/13 10:02:40 mcalabre Exp mcalabre $
@


4.19.1.1
log
@WCSLIB 4.19 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 4.19 2013/09/29 14:17:53 mcalabre Exp $
@


4.18
log
@WCSLIB 4.18
@
text
@d3 1
a3 1
  PGSBOX 4.18 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 4.17.1.1 2013/01/29 05:32:33 cal103 Exp cal103 $
@


4.18.1.1
log
@WCSLIB 4.18 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 4.18 2013/07/13 10:00:06 mcalabre Exp $
@


4.17
log
@WCSLIB 4.17
@
text
@d3 1
a3 1
  PGSBOX 4.17 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 4.16.1.2 2013/01/29 05:11:32 cal103 Exp cal103 $
@


4.17.1.1
log
@WCSLIB 4.17 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 4.17 2013/01/29 05:29:22 cal103 Exp $
@


4.16
log
@WCSLIB 4.16
@
text
@d3 2
a4 2
  PGSBOX 4.16 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2012, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 4.15.1.1 2012/09/26 14:27:53 cal103 Exp cal103 $
@


4.16.1.1
log
@WCSLIB 4.16 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 4.16 2012/11/07 04:42:45 cal103 Exp $
@


4.16.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2013, Mark Calabretta
d25 1
a25 1
  $Id: cpgtest.c,v 4.16.1.1 2012/11/07 04:45:58 cal103 Exp cal103 $
@


4.15
log
@WCSLIB 4.15
@
text
@d3 1
a3 1
  PGSBOX 4.15 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 4.14.1.1 2012/07/13 10:05:05 cal103 Exp cal103 $
@


4.15.1.1
log
@WCSLIB 4.15 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 4.15 2012/09/26 14:26:06 cal103 Exp $
@


4.14
log
@WCSLIB 4.14
@
text
@d3 1
a3 1
  PGSBOX 4.14 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: cpgtest.c,v 4.13.1.2 2012/07/13 03:43:52 cal103 Exp cal103 $
@


4.14.1.1
log
@WCSLIB 4.14 development branch.
@
text
@d25 1
a25 1
  $Id: cpgtest.c,v 4.14 2012/07/13 10:02:47 cal103 Exp $
@


4.13
log
@WCSLIB 4.13
@
text
@d3 1
a3 1
  PGSBOX 4.13 - draw curvilinear coordinate axes for PGPLOT.
d19 1
a19 1
  along with PGSBOX.  If not, see <http://www.gnu.org/licenses/>.
d21 5
a25 11
  Correspondence concerning PGSBOX may be directed to:
    Internet email: mcalabre@@atnf.csiro.au
    Postal address: Dr. Mark Calabretta
                    Australia Telescope National Facility, CSIRO
                    PO Box 76
                    Epping NSW 1710
                    AUSTRALIA

  Author: Mark Calabretta, Australia Telescope National Facility
  http://www.atnf.csiro.au/~mcalabre/index.html
  $Id: cpgtest.c,v 4.12.1.1 2012/02/29 07:59:11 cal103 Exp cal103 $
@


4.13.1.1
log
@WCSLIB 4.13 development branch.
@
text
@d31 1
a31 1
  $Id: cpgtest.c,v 4.13 2012/03/14 07:39:31 cal103 Exp $
@


4.13.1.2
log
@Changed contact details.
@
text
@d19 1
a19 1
  along with PGSBOX.  If not, see http://www.gnu.org/licenses.
d21 11
a31 5
  Direct correspondence concerning PGSBOX to mark@@calabretta.id.au

  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
  http://www.atnf.csiro.au/people/Mark.Calabretta
  $Id: cpgtest.c,v 4.13.1.1 2012/03/14 07:40:39 cal103 Exp cal103 $
@


4.12
log
@WCSLIB 4.12
@
text
@d3 1
a3 1
  PGSBOX 4.12 - draw curvilinear coordinate axes for PGPLOT.
d31 1
a31 1
  $Id: cpgtest.c,v 4.11.1.1 2012/02/20 23:31:14 cal103 Exp cal103 $
@


4.12.1.1
log
@WCSLIB 4.12 development branch.
@
text
@d31 1
a31 1
  $Id: cpgtest.c,v 4.12 2012/02/29 07:57:57 cal103 Exp $
@


4.11
log
@WCSLIB 4.11
@
text
@d3 1
a3 1
  PGSBOX 4.11 - draw curvilinear coordinate axes for PGPLOT.
d31 1
a31 1
  $Id: cpgtest.c,v 4.10.1.1 2012/02/05 23:42:47 cal103 Exp cal103 $
@


4.11.1.1
log
@WCSLIB 4.11 development branch.
@
text
@d31 1
a31 1
  $Id: cpgtest.c,v 4.11 2012/02/20 23:30:03 cal103 Exp $
@


4.10
log
@WCSLIB 4.10
@
text
@d3 1
a3 1
  PGSBOX 4.10 - draw curvilinear coordinate axes for PGPLOT.
d31 1
a31 1
  $Id: cpgtest.c,v 4.9.1.1 2012/01/24 05:41:46 cal103 Exp cal103 $
@


4.10.1.1
log
@WCSLIB 4.10 development branch.
@
text
@d31 1
a31 1
  $Id: cpgtest.c,v 4.10 2012/02/05 23:41:45 cal103 Exp $
@


4.9
log
@WCSLIB 4.9
@
text
@d3 1
a3 1
  PGSBOX 4.9 - draw curvilinear coordinate axes for PGPLOT.
d31 1
a31 1
  $Id: cpgtest.c,v 4.8.1.2 2012/01/24 05:24:50 cal103 Exp cal103 $
@


4.9.1.1
log
@WCSLIB 4.9 development branch.
@
text
@d31 1
a31 1
  $Id: cpgtest.c,v 4.9 2012/01/24 05:40:30 cal103 Exp $
@


4.8
log
@WCSLIB 4.8
@
text
@d3 2
a4 2
  PGSBOX 4.8 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2011, Mark Calabretta
d31 1
a31 1
  $Id: cpgtest.c,v 4.7.1.1 2011/02/07 07:04:23 cal103 Exp cal103 $
@


4.8.1.1
log
@WCSLIB 4.8 development branch.
@
text
@d31 1
a31 1
  $Id: cpgtest.c,v 4.8 2011/08/15 08:05:55 cal103 Exp $
@


4.8.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2012, Mark Calabretta
d31 1
a31 1
  $Id: cpgtest.c,v 4.8.1.1 2011/08/15 08:07:07 cal103 Exp cal103 $
@


4.7
log
@WCSLIB 4.7
@
text
@d3 1
a3 1
  PGSBOX 4.7 - draw curvilinear coordinate axes for PGPLOT.
d31 1
a31 1
  $Id: cpgtest.c,v 4.6.1.2 2011/01/14 06:35:20 cal103 Exp cal103 $
@


4.7.1.1
log
@WCSLIB 4.7 development branch.
@
text
@d31 1
a31 1
  $Id: cpgtest.c,v 4.7 2011/02/07 07:03:43 cal103 Exp $
@


4.6
log
@WCSLIB 4.6
@
text
@d3 2
a4 2
  PGSBOX 4.6 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2010, Mark Calabretta
d31 1
a31 1
  $Id: cpgtest.c,v 4.5.1.1 2010/07/16 07:05:33 cal103 Exp cal103 $
@


4.6.1.1
log
@WCSLIB 4.6 development branch.
@
text
@d31 1
a31 1
  $Id: cpgtest.c,v 4.6 2010/11/16 06:15:32 cal103 Exp $
@


4.6.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2011, Mark Calabretta
d31 1
a31 1
  $Id: cpgtest.c,v 4.6.1.1 2010/11/16 06:16:20 cal103 Exp cal103 $
@


4.5
log
@WCSLIB 4.5
@
text
@d3 1
a3 1
  PGSBOX 4.5 - draw curvilinear coordinate axes for PGPLOT.
d31 1
a31 1
  $Id: cpgtest.c,v 4.4.1.3 2010/07/14 12:58:00 cal103 Exp cal103 $
@


4.5.1.1
log
@WCSLIB 4.5 development branch.
@
text
@d31 1
a31 1
  $Id: cpgtest.c,v 4.5 2010/07/16 07:01:27 cal103 Exp $
@


4.4
log
@WCSLIB 4.4
@
text
@d3 2
a4 2
  PGSBOX 4.4 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2009, Mark Calabretta
d31 1
a31 1
  $Id: cpgtest.c,v 4.3.1.2 2009/07/23 04:17:17 cal103 Exp cal103 $
d278 2
a279 2
  strcpy(fcode[0], "Lin ");
  strcpy(fcode[1], "Log ");
d1160 2
a1161 2
  strcpy(fcode[0], "Lin ");
  strcpy(fcode[1], "Lin ");
@


4.4.1.1
log
@WCSLIB 4.4 development branch.
@
text
@d31 1
a31 1
  $Id: cpgtest.c,v 4.4 2009/08/06 07:54:40 cal103 Exp $
@


4.4.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2010, Mark Calabretta
d31 1
a31 1
  $Id: cpgtest.c,v 4.4.1.1 2009/08/10 08:55:45 cal103 Exp cal103 $
@


4.4.1.3
log
@Fixed the initialization of fcode in two tests.
@
text
@d31 1
a31 1
  $Id: cpgtest.c,v 4.4.1.2 2010/01/19 03:45:24 cal103 Exp cal103 $
d278 2
a279 2
  strncpy(fcode[0], "Lin ", 4);
  strncpy(fcode[1], "Log ", 4);
d1160 2
a1161 2
  strncpy(fcode[0], "Lin ", 4);
  strncpy(fcode[1], "Lin ", 4);
@


4.3
log
@PGSBOX 4.3
@
text
@d3 2
a4 2
    PGSBOX 4.3 - an implementation of the FITS WCS standard.
    Copyright (C) 1997-2007, Mark Calabretta
d6 1
a6 1
    This file is part of PGSBOX.
d8 24
a31 24
    PGSBOX is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License as published by the
    Free Software Foundation, either version 3 of the License, or (at your
    option) any later version.

    PGSBOX is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
    more details.

    You should have received a copy of the GNU Lesser General Public License
    along with PGSBOX.  If not, see <http://www.gnu.org/licenses/>.

    Correspondence concerning PGSBOX may be directed to:
       Internet email: mcalabre@@atnf.csiro.au
       Postal address: Dr. Mark Calabretta
                       Australia Telescope National Facility, CSIRO
                       PO Box 76
                       Epping NSW 1710
                       AUSTRALIA

    Author: Mark Calabretta, Australia Telescope National Facility
    http://www.atnf.csiro.au/~mcalabre/index.html
    $Id: cpgtest.c,v 4.2.1.5 2007/12/22 04:01:45 cal103 Exp cal103 $
d57 2
a58 2
   const double pi = 3.141592653589793238462643;
   const double d2r = pi/180.0;
d60 64
a123 64
   char   devtyp[16], fcode[2][4], idents[3][80], nlcprm[1], opt[2];
   int    c0[7], ci[7], gcode[2], ic, ierr, j, large, naxis[2], nliprm[2],
          status;
   float  blc[2], scl, trc[2];
   double cache[257][4], dec0, grid1[9], grid2[9], nldprm[8], rotn, tiklen;
   struct wcsprm wcs;
   nlfunc_t lngvel_, fscan_, pgcrfn_, pgwcsl_;

   /* Setup. */
   naxis[0] = 512;
   naxis[1] = 512;

   blc[0] = 0.5f;
   blc[1] = 0.5f;
   trc[0] = naxis[0] + 0.5f;
   trc[1] = naxis[1] + 0.5f;

   strcpy(devtyp, "/XWINDOW");
   cpgbeg(0, devtyp, 1, 1);

   j = 16;
   cpgqinf("TYPE", devtyp, &j);
   if (strcmp(devtyp, "PS") == 0  ||
       strcmp(devtyp, "VPS") == 0 ||
       strcmp(devtyp, "CPS") == 0 ||
       strcmp(devtyp, "VCPS") == 0) {
      /* Switch black and white. */
      cpgscr(0, 1.0f, 1.0f, 1.0f);
      cpgscr(1, 0.0f, 0.0f, 0.0f);
   }

   large = strcmp(devtyp, "XWINDOW") == 0;
   if (large) {
      scl = 1.0f;
      cpgvstd();
   } else {
      scl = 0.7f;
      cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
   }

   /* Yellow. */
   cpgscr(2, 1.0f, 1.0f, 0.0f);
   /* White. */
   cpgscr(3, 1.0f, 1.0f, 1.0f);
   /* Pale blue. */
   cpgscr(4, 0.5f, 0.5f, 0.8f);
   /* Pale red. */
   cpgscr(5, 0.8f, 0.5f, 0.5f);
   /* Grey. */
   cpgscr(6, 0.7f, 0.7f, 0.7f);
   /* Dark green. */
   cpgscr(7, 0.3f, 0.5f, 0.3f);

   c0[0] = -1;
   c0[1] = -1;
   c0[2] = -1;
   c0[3] = -1;
   c0[4] = -1;
   c0[5] = -1;
   c0[6] = -1;

   cpgwnad(0.0f, 1.0f, 0.0f, 1.0f);
   cpgask(1);
   cpgpage();
d125 1
a125 1
   wcs.flag = -1;
d128 64
a191 64
   * Longitude-velocity map; the y-axis is regularly spaced in frequency but
   * is to be labelled as a true relativistic velocity.
   *    - PGSBOX uses subroutine LNGVEL.
   *    - Separable (i.e. orthogonal), non-linear coordinate system.
   *    - Automatic choice of coordinate increments.
   *    - Extraction of a common scaling factor.
   *    - Automatic choice of what edges to label.
   *    - Request for tickmarks (internal) for one coordinate and grid lines
   *      for the other.
   *    - Simple two-colour grid using two calls with deferred labelling on
   *      the first call.
   *    - Degree labelling.
   *    - Suppression of zero arcmin and arcsec fields in sexagesimal degree
   *      format.
   *------------------------------------------------------------------------*/

   printf("\nLongitude-velocity map\n");

   /* Reference pixel coordinates. */
   nldprm[0] =   1.0;
   nldprm[1] = 256.0;

   /* Reference pixel values. */
   nldprm[2] = 0.0;
   nldprm[3] = 1.420e9;

   /* Coordinate increments. */
   nldprm[4] = 360.0/(naxis[0]-1);
   nldprm[5] = 4e6;

   /* Rest frequency. */
   nldprm[6] = 1.420e9;

   /* Annotation. */
   strcpy(idents[0], "galactic longitude");
   strcpy(idents[1], "velocity (m/s)");
   strcpy(idents[2], "HI line");

   opt[0] = 'F';
   opt[1] = ' ';

   /* Normal size lettering. */
   cpgsch(1.0f*scl);

   /* Yellow tick marks for longitude and grid lines for velocity. */
   cpgsci(2);
   gcode[0] = 1;
   gcode[1] = 2;
   grid1[0] = 0.0;
   grid2[0] = 0.0;

   /* Defer labelling. */
   ic = -1;
   cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 2.0, 0, grid1, 0, grid2,
      0, lngvel_, 1, 1, 7, nlcprm, nliprm, nldprm, 256, &ic, cache, &ierr);

   /* Draw fiducial grid lines in white and do labelling. */
   cpgsci(1);
   gcode[0] = 2;
   gcode[1] = 2;
   grid1[1] = 180.0;
   grid2[1] = 0.0;
   cpgsbox(blc, trc, idents, opt, 0, 0, c0, gcode, 0.0, 1, grid1, 1, grid2,
      0, lngvel_, 1, 1, 7, nlcprm, nliprm, nldprm, 256, &ic, cache, &ierr);
d193 2
a194 2
   /* Draw the frame. */
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d196 1
a196 1
   cpgpage();
d199 57
a255 57
   * Azimuth-frequency scan; this sort of output might be obtained from an
   * antenna that scans in azimuth with a receiver that scans simultaneously
   * in frequency.
   *    - PGSBOX uses subroutine FSCAN.
   *    - Non-separable (i.e. non-orthogonal) non-linear coordinate system.
   *    - Automatic choice of what edges to label; results in labelling the
   *      bottom, left and right sides of the plot.
   *    - Cyclic labelling.  FSCAN returns the azimuth in the range
   *      0 - 720 degrees but PGSBOX is set to normalize this to two cycles of
   *      0 - 360 degrees.
   *    - Logarithmic labelling.
   *    - Automatic choice of coordinate increments but with request for all
   *      grid lines for the logarithmic coordinate.
   *    - Degree labelling.
   *    - Suppression of common zero arcmin and arcsec fields in sexagesimal
   *      degree format.
   *------------------------------------------------------------------------*/

   printf("\nAzimuth-frequency scan\n");

   /* Reference pixel coordinates. */
   nldprm[0] = 0.5;
   nldprm[1] = 0.5;

   /* Reference pixel values. */
   nldprm[2] = 0.0;
   nldprm[3] = 8.5;

   /* Coordinate increments. */
   nldprm[4] = 720.0/(naxis[0]+1);
   nldprm[5] = 0.002;

   /* Rate of change of NLDPRM[3] with x-pixel. */
   nldprm[6] = -0.002;

   /* Annotation. */
   strcpy(idents[0], "azimuth");
   strcpy(idents[1], "\\gn/Hz");
   strcpy(idents[2], "Frequency/azimuth scan");

   opt[0] = 'D';
   opt[1] = 'L';

   /* Normal size lettering. */
   cpgsch(1.0f*scl);

   /* Draw full grid lines. */
   cpgsci(1);
   gcode[0] = 2;
   gcode[1] = 2;
   grid1[0] = 0.0;
   grid2[0] = 0.0;

   /* Setting labden = 9900 forces all logarithmic grid lines to be drawn. */
   ic = -1;
   cpgsbox(blc, trc, idents, opt, 0, 9900, c0, gcode, 2.0, 0, grid1, 0, grid2,
      0, fscan_, 1, 1, 7, nlcprm, nliprm, nldprm, 256, &ic, cache, &ierr);
d257 2
a258 2
   /* Draw the frame. */
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d260 1
a260 1
   cpgpage();
d264 50
a313 50
   * Z versus time plot.
   *    - PGSBOX uses subroutine PGCRFN.
   *    - Separable (i.e. orthogonal), non-linear coordinate system.
   *    - Use of function PGCRFN for separable axis types.
   *    - Automatic choice of what edges to label; results in labelling the
   *      bottom and left sides of the plot.
   *    - Automatic choice of coordinate increments.
   *    - Logarithmic labelling over many orders of magnitude.
   *    - Single-character annotation on a vertical axis is upright.
   *------------------------------------------------------------------------*/

   printf("\nZ versus time plot\n");

   /* Function types. */
   strcpy(fcode[0], "Lin ");
   strcpy(fcode[1], "Log ");

   /* Reference pixel coordinates. */
   nldprm[0] =   0.5;
   nldprm[1] = -50.0;

   /* Coordinate increments. */
   nldprm[2] = 0.04;
   nldprm[3] = 0.02;

   /* Reference pixel values. */
   nldprm[4] = -3.0;
   nldprm[5] =  1.0;

   /* Annotation. */
   strcpy(idents[0], "Age of universe (sec)");
   strcpy(idents[1], "Y");
   strcpy(idents[2], "");

   opt[0] = 'L';
   opt[1] = ' ';

   /* Normal size lettering. */
   cpgsch(1.0f*scl);

   /* Draw ticks for the first coordinate, grid lines for the second. */
   cpgsci(1);
   gcode[0] = 1;
   gcode[1] = 2;
   grid1[0] = 0.0;
   grid2[0] = 0.0;

   ic = -1;
   cpgsbox(blc, trc, idents, opt, 0, 0, c0, gcode, 2.0, 0, grid1, 0, grid2, 0,
      pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache, &ierr);
d315 2
a316 2
   /* Draw the frame. */
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d318 1
a318 1
   cpgpage();
d321 75
a395 75
   * Simple SIN projection near the south celestial pole.
   *    - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
   *    - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
   *    - Demonstrate parameter definition for PGWCSL.
   *    - Discovery of grid lines that do not cross any axis.
   *    - Automatic choice of what edges to label; results in labelling all
   *      sides of the plot.
   *    - Automatic choice of coordinate increments but with request for
   *      increased grid density for each coordinate.
   *    - Double precision accuracy.
   *    - Cyclic coordinates.  PGWCSL returns the right ascension in the range
   *      -180 to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
   *    - Labelling of degrees as time in the range 0 - 24h.
   *    - Suppression of labels that would overlap one another.
   *    - Sexagesimal degree labelling with automatically determined
   *      precision.
   *    - Suppression of common zero minute and second fields in sexagesimal
   *      time format.
   *------------------------------------------------------------------------*/

   printf("\nSimple SIN projection\n");

   wcs.flag = -1;
   status = wcsini(1, 2, &wcs);

   /* Set projection type to SIN. */
   strcpy(wcs.ctype[0], "RA---SIN");
   strcpy(wcs.ctype[1], "DEC--SIN");

   /* Reference pixel coordinates. */
   wcs.crpix[0] = 384.0;
   wcs.crpix[1] = 256.0;

   /* Coordinate increments. */
   wcs.cdelt[0] = -1.0/3600000.0;
   wcs.cdelt[1] =  1.0/3600000.0;

   /* Spherical coordinate references. */
   dec0 = -89.99995;
   wcs.crval[0] = 25.0;
   wcs.crval[1] = dec0;

   /* Set parameters for an NCP projection. */
   dec0 *= d2r;
   wcs.pv[0].i = 2;
   wcs.pv[0].m = 1;
   wcs.pv[0].value = 0.0;
   wcs.pv[0].i = 2;
   wcs.pv[1].m = 2;
   wcs.pv[1].value = cos(dec0)/sin(dec0);

   /* Annotation. */
   strcpy(idents[0], "Right ascension");
   strcpy(idents[1], "Declination");
   strcpy(idents[2], "WCS SIN projection");

   opt[0] = 'G';
   opt[1] = 'E';

   /* Compact lettering. */
   cpgsch(0.8f*scl);

   /* Draw full grid lines. */
   cpgsci(1);
   gcode[0] = 2;
   gcode[1] = 2;
   grid1[0] = 0.0;
   grid2[0] = 0.0;

   /* Draw the celestial grid.  The grid density is set for each world */
   /* coordinate by specifying LABDEN = 1224. */
   ic = -1;
   cpgsbox(blc, trc, idents, opt, 0, 1224, c0, gcode, 0.0, 0, grid1, 0, grid2,
      0, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
      cache, &ierr);
d397 2
a398 2
   /* Draw the frame. */
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d400 1
a400 1
   cpgpage();
d403 118
a520 118
   * Conic equal area projection.
   *    - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
   *    - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
   *    - Coordinate system undefined in areas of the plot.
   *    - Demonstrate parameter definition for PGWCSL.
   *    - Discontinuous grid lines handled by PGWCSL.
   *    - Discovery of grid lines that do not cross any axis.
   *    - Colour control for grid and labelling.
   *    - Reduced size lettering.
   *    - Automatic choice of what edges to label; results in labelling all
   *      sides of the plot.
   *    - Automatic choice of coordinate increments.
   *    - Cyclic coordinates.  PGWCSL returns the longitude in the range -180
   *      to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
   *    - Suppression of labels that would overlap one another.
   *    - Suppression of common zero arcmin and arcsec fields in sexagesimal
   *      degree format.
   *------------------------------------------------------------------------*/

   printf("\nConic equal area projection\n");

   status = wcsini(1, 2, &wcs);

   /* Set projection type to conic equal-area. */
   strcpy(wcs.ctype[0], "RA---COE");
   strcpy(wcs.ctype[1], "DEC--COE");

   /* Reference pixel coordinates. */
   wcs.crpix[0] = 256.0;
   wcs.crpix[1] = 256.0;

   /* Coordinate increments. */
   wcs.cdelt[0] = -1.0/3.0;
   wcs.cdelt[1] =  1.0/3.0;

   /* Spherical coordinate references. */
   wcs.crval[0] =  90.0;
   wcs.crval[1] =  30.0;
   wcs.lonpole  = 150.0;

   /* Middle latitude and offset from standard parallels. */
   wcs.npv = 2;
   wcs.pv[0].i = 2;
   wcs.pv[0].m = 1;
   wcs.pv[0].value = 60.0;
   wcs.pv[1].i = 2;
   wcs.pv[1].m = 2;
   wcs.pv[1].value = 15.0;

   /* Annotation. */
   strcpy(idents[0], "longitude");
   strcpy(idents[1], "latitude");
   strcpy(idents[2], "WCS conic equal area projection");

   opt[0] = 'E';
   opt[1] = 'E';

   /* Reduced size lettering. */
   cpgsch(0.8f*scl);

   /* Draw full grid lines. */
   gcode[0] = 2;
   gcode[1] = 2;
   grid1[0] = 0.0;
   grid2[0] = 0.0;

   /* Use colour to associate grid lines and labels. */
   /* Meridians in red. */
   cpgscr(10, 0.5f, 0.0f, 0.0f);
   /* Parallels in blue. */
   cpgscr(11, 0.0f, 0.2f, 0.5f);
   /* Longitudes in red. */
   cpgscr(12, 0.8f, 0.3f, 0.0f);
   /* Latitudes in blue. */
   cpgscr(13, 0.0f, 0.4f, 0.7f);
   /* Longitude labels in red. */
   cpgscr(14, 0.8f, 0.3f, 0.0f);
   /* Latitude labels in blue. */
   cpgscr(15, 0.0f, 0.4f, 0.7f);
   /* Title in cyan. */
   cpgscr(16, 0.3f, 1.0f, 1.0f);

   ci[0] = 10;
   ci[1] = 11;
   ci[2] = 12;
   ci[3] = 13;
   ci[4] = 14;
   ci[5] = 15;
   ci[6] = 16;

   /* Draw the celestial grid letting PGSBOX choose the increments. */
   ic = -1;
   cpgsbox(blc, trc, idents, opt, 0, 0, ci, gcode, 0.0, 0, grid1, 0, grid2, 1,
      pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic, cache,
      &ierr);

   /* Set parameters to draw the native grid. */
   wcs.crval[0] =   0.0;
   wcs.crval[1] =  60.0;
   wcs.lonpole  = 999.0;
   wcs.latpole  = 999.0;
   status = wcsset(&wcs);

   /* We just want to delineate the boundary, in green. */
   cpgsci(7);
   grid1[1] = -180.0;
   grid1[2] =  180.0;
   grid2[1] =  -90.0;
   grid2[2] =   90.0;

   ic = -1;
   cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 2, grid1, 2, grid2,
      1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
      cache, &ierr);

   /* Draw the frame. */
   cpgsci(1);
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d522 1
a522 1
   cpgpage();
d525 206
a730 206
   * Polyconic projection with colour-coded grid.
   *    - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
   *    - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
   *    - Coordinate system undefined in areas of the plot.
   *    - Demonstrate parameter definition for PGWCSL.
   *    - Discontinuous grid lines handled by PGWCSL.
   *    - Colour coded labelling.
   *    - Colour coded grid implemented by the caller.
   *    - Basic management of the axis-crossing table (see code).
   *    - Reduced size lettering.
   *    - Tick marks external to the frame.
   *    - User selection of what edges to label with request for both
   *      coordinates to be labelled on bottom, left and top edges.
   *    - User selection of grid lines to plot.
   *    - Concatenation of annotation at bottom and left; automatically
   *      suppressed at the top since only one coordinate is labelled there.
   *    - Suppression of labels that would overlap one another.
   *    - Degree labelling.
   *    - Labelling of degrees as time in the range -12 - +12h.
   *    - Suppression of common zero minute and second fields in sexagesimal
   *      time format.
   *------------------------------------------------------------------------*/

   printf("\nPolyconic projection with colour-coded grid\n");

   status = wcsini(1, 2, &wcs);

   /* Set projection type to polyconic. */
   strcpy(wcs.ctype[0], "RA---PCO");
   strcpy(wcs.ctype[1], "DEC--PCO");

   /* Reference pixel coordinates. */
   wcs.crpix[0] = 192.0;
   wcs.crpix[1] = 640.0;

   /* Rotate 30 degrees. */
   rotn = 30.0*d2r;
   *(wcs.pc)   =  cos(rotn);
   *(wcs.pc+1) =  sin(rotn);
   *(wcs.pc+2) = -sin(rotn);
   *(wcs.pc+3) =  cos(rotn);

   /* Coordinate increments. */
   wcs.cdelt[0] = -1.0/5.0;
   wcs.cdelt[1] =  1.0/5.0;

   /* Spherical coordinate references. */
   wcs.crval[0] = 332.0;
   wcs.crval[1] =  40.0;
   wcs.lonpole  = -30.0;

   /* Annotation. */
   strcpy(idents[0], "Hour angle");
   strcpy(idents[1], "Declination");
   strcpy(idents[2], "WCS polyconic projection");

   opt[0] = 'H';
   opt[1] = 'B';

   /* Reduced size lettering. */
   cpgsch(0.9f*scl);

   /* Draw external (TIKLEN < 0) tick marks every 5 degrees. */
   gcode[0] = 1;
   gcode[1] = 1;
   tiklen = -2.0;

   cpgsci(6);
   grid1[0] = 5.0;
   grid2[0] = 5.0;

   ic = -1;
   cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, tiklen, 0, grid1, 0,
      grid2, 1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
      &ic, cache, &ierr);

   /* Resetting the table index to zero causes information about the */
   /* tick marks to be discarded. */
   ic = 0;

   /* Draw full grid lines in yellow rather than tick marks. */
   cpgsci(2);
   gcode[0] = 2;
   gcode[1] = 2;

   /* Draw the primary meridian and equator. */
   grid1[1] = 0.0;
   grid2[1] = 0.0;
   cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 1, grid1, 1, grid2,
      1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
      cache, &ierr);

   /* At this point the axis-crossing table will have entries for the  */
   /* primary meridian and equator.  Labelling was deferred in the     */
   /* previous call, and the table is passed intact on the second call */
   /* to accumulate further axis-crossings.                            */

   /* Draw 90 degree meridians and poles in white. */
   cpgsci(3);
   grid1[1] =  90.0;
   grid1[2] = 180.0;
   grid1[3] = 270.0;
   grid2[1] = -90.0;
   grid2[2] =  90.0;
   cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 3, grid1, 2, grid2,
      1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
      cache, &ierr);

   /* Draw the first set of 15 degree meridians and parallels in blue. */
   cpgsci(4);
   grid1[1] =  15.0;
   grid1[2] =  60.0;
   grid1[3] = 105.0;
   grid1[4] = 150.0;
   grid1[5] = 195.0;
   grid1[6] = 240.0;
   grid1[7] = 285.0;
   grid1[8] = 330.0;
   grid2[1] = -75.0;
   grid2[2] = -30.0;
   grid2[3] =  15.0;
   grid2[4] =  60.0;
   cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 8, grid1, 4, grid2,
      1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
      cache, &ierr);

   /* Draw the second set of 15 degree meridians and parallels in red. */
   cpgsci(5);
   grid1[1] =  30.0;
   grid1[2] =  75.0;
   grid1[3] = 120.0;
   grid1[4] = 165.0;
   grid1[5] = 210.0;
   grid1[6] = 255.0;
   grid1[7] = 300.0;
   grid1[8] = 345.0;
   grid2[1] = -60.0;
   grid2[2] = -15.0;
   grid2[3] =  30.0;
   grid2[4] =  75.0;
   cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 8, grid1, 4, grid2,
      1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
      cache, &ierr);

   /* The axis-crossing table has now accumulated information for all of */
   /* the preceding meridians and parallels but no labels have been      */
   /* produced.  It will acquire information for the the next set of     */
   /* meridians and parallels before being processed by this call to     */
   /* PGSBOX which finally produces the labels.                          */

   /* Draw the 45 degree meridians and parallels in grey and use colour  */
   /* to differentiate grid labels. */
   /* Meridians and parallels in grey. */
   cpgscr(10, 0.7f, 0.7f, 0.7f);
   cpgscr(11, 0.7f, 0.7f, 0.7f);
   /* Longitudes tinged red. */
   cpgscr(12, 1.0f, 0.9f, 0.6f);
   /* Latitudes tinged green. */
   cpgscr(13, 0.8f, 1.0f, 0.9f);
   /* Longitude labels tinged red. */
   cpgscr(14, 1.0f, 0.9f, 0.6f);
   /* Latitude labels tinged green. */
   cpgscr(15, 0.8f, 1.0f, 0.9f);
   /* Title in white. */
   cpgscr(16, 1.0f, 1.0f, 1.0f);

   ci[0] = 10;
   ci[1] = 11;
   ci[2] = 12;
   ci[3] = 13;
   ci[4] = 14;
   ci[5] = 15;
   ci[6] = 16;

   cpgsci(6);

   /* Tell PGSBOX what edges to label. */
   grid1[1] =  45.0;
   grid1[2] = 135.0;
   grid1[3] = 225.0;
   grid1[4] = 315.0;
   grid2[1] = -45.0;
   grid2[2] =  45.0;
   cpgsbox(blc, trc, idents, opt, 2333, 0, ci, gcode, 0.0, 4, grid1, 2, grid2,
      1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
      cache, &ierr);

   /* Native grid in green (delineates boundary). */
   cpgsci(7);
   grid1[1] = -180.0;
   grid1[2] =  180.0;
   grid2[1] = -999.0;

   wcs.crval[0] =   0.0;
   wcs.crval[1] =   0.0;
   wcs.lonpole  = 999.0;
   status = wcsset(&wcs);

   ic = -1;
   cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 2, grid1, 1, grid2,
      1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
      cache, &ierr);

   /* Draw the frame. */
   cpgsci(1);
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d732 1
a732 1
   cpgpage();
d735 156
a890 156
   * Plate Carree projection.
   *    - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
   *    - Rectangular image.
   *    - Dual coordinate grids.
   *    - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
   *    - Demonstrate parameter definition for PGWCSL.
   *    - Discontinuous grid lines handled by PGWCSL.
   *    - Colour coding of grid and labelling.
   *    - Reduced size lettering.
   *    - Manual labelling control.
   *    - Manual and automatic choice of coordinate increments.
   *    - Cyclic coordinates.  PGWCSL returns the longitude in the range -180
   *      to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
   *    - Suppression of labels that would overlap one another.
   *------------------------------------------------------------------------*/

   printf("\nPlate Carree projection\n");

   naxis[0] = 181;
   naxis[1] =  91;

   blc[0] = 0.5;
   blc[1] = 0.5;
   trc[0] = naxis[0] + 0.5;
   trc[1] = naxis[1] + 0.5;

   /* Reset viewport for rectangular image. */
   if (large) {
      cpgvstd();
   } else {
      cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
   }
   cpgwnad(0.0f, 1.0f, 0.0f, ((float)naxis[1])/((float)naxis[0]));

   status = wcsini(1, 2, &wcs);

   /* Set projection type to plate carree. */
   strcpy(wcs.ctype[0], "GLON-CAR");
   strcpy(wcs.ctype[1], "GLAT-CAR");

   /* Reference pixel coordinates. */
   wcs.crpix[0] = 226.0;
   wcs.crpix[1] =  46.0;

   /* Linear transformation matrix. */
   rotn = 15.0*d2r;
   *(wcs.pc)   =  cos(rotn);
   *(wcs.pc+1) =  sin(rotn);
   *(wcs.pc+2) = -sin(rotn);
   *(wcs.pc+3) =  cos(rotn);

   /* Coordinate increments. */
   wcs.cdelt[0] = -1.0;
   wcs.cdelt[1] =  1.0;

   /* Set parameters to draw the native grid. */
   wcs.crval[0] = 0.0;
   wcs.crval[1] = 0.0;

   /* The reference pixel was defined so that the native longitude runs   */
   /* from 225 deg to 45 deg and this will cause the grid to be truncated */
   /* at the 180 deg boundary.  However, being a cylindrical projection   */
   /* it is possible to recentre it in longitude.  cylfix() will modify   */
   /* modify CRPIX, CRVAL, and LONPOLE to suit.                           */

   status = cylfix(naxis, &wcs);

   /* Annotation. */
   strcpy(idents[0], "");
   strcpy(idents[1], "");
   strcpy(idents[2], "WCS plate caree projection");

   opt[0] = 'C';
   opt[1] = 'C';

   /* Reduced size lettering. */
   cpgsch(0.8f*scl);

   /* Draw full grid lines. */
   gcode[0] = 2;
   gcode[1] = 2;

   /* Draw native grid in green. */
   cpgscr(16, 0.0f, 0.2f, 0.0f);
   /* Title in cyan. */
   cpgscr(17, 0.3f, 1.0f, 1.0f);

   ci[0] = 16;
   ci[1] = 16;
   ci[2] =  7;
   ci[3] =  7;
   ci[4] = -1;
   ci[5] = -1;
   ci[6] = 17;

   grid1[0] = 15.0;
   grid2[0] = 15.0;
   ic = -1;
   cpgsbox(blc, trc, idents, opt, 2100, 0, ci, gcode, 0.0, 0, grid1, 0, grid2,
      1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
      cache, &ierr);

   /* Reset CRPIX previously modified by cylfix(). */
   wcs.crpix[0] = 226.0;
   wcs.crpix[1] =  46.0;

   /* Galactic reference coordinates. */
   wcs.crval[0] =  30.0;
   wcs.crval[1] =  35.0;
   wcs.lonpole  = 999.0;
   status = wcsset(&wcs);

   status = cylfix(naxis, &wcs);

   /* Annotation. */
   strcpy(idents[0], "longitude");
   strcpy(idents[1], "latitude");
   strcpy(idents[2], "");

   opt[0] = 'E';
   opt[1] = 'E';

   /* Use colour to associate grid lines and labels. */
   /* Meridians in red. */
   cpgscr(10, 0.5f, 0.0f, 0.0f);
   /* Parallels in blue. */
   cpgscr(11, 0.0f, 0.2f, 0.5f);
   /* Longitudes in red. */
   cpgscr(12, 0.8f, 0.3f, 0.0f);
   /* Latitudes in blue. */
   cpgscr(13, 0.0f, 0.4f, 0.7f);
   /* Longitude labels in red. */
   cpgscr(14, 0.8f, 0.3f, 0.0f);
   /* Latitude labels in blue. */
   cpgscr(15, 0.0f, 0.4f, 0.7f);

   ci[0] = 10;
   ci[1] = 11;
   ci[2] = 12;
   ci[3] = 13;
   ci[4] = 14;
   ci[5] = 15;
   ci[6] = -1;

   grid1[0] = 0.0;
   grid2[0] = 0.0;

   /* Draw the celestial grid letting PGSBOX choose the increments. */
   ic = -1;
   cpgsbox(blc, trc, idents, opt, 21, 0, ci, gcode, 0.0, 0, grid1, 0, grid2,
      1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
      cache, &ierr);

   /* Draw the frame. */
   cpgsci(1);
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d892 1
a892 1
   cpgpage();
d895 68
a962 68
   * Plate Carree projection.
   *    - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
   *    - BLC, TRC unrelated to pixel coordinates.
   *    - Demonstrate parameter definition for PGWCSL.
   *    - Poles and 180 meridian projected along edges of the frame.
   *    - Reduced size lettering.
   *    - Manual and automatic choice of coordinate increments.
   *    - Suppression of common zero minute and second fields in
   *      sexagesimal time format.
   *------------------------------------------------------------------------*/

   printf("\nPlate Carree projection\n");

   blc[0] = -180.0;
   blc[1] =  -90.0;
   trc[0] =  180.0;
   trc[1] =  +90.0;

   /*  Reset viewport for rectangular image. */
   if (large) {
      cpgvstd();
   } else {
      cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
   }
   cpgwnad (blc[0], trc[0], blc[1], trc[1]);

   status = wcsini(1, 2, &wcs);

   /* Set projection type to plate carree. */
   strcpy(wcs.ctype[0], "RA---CAR");
   strcpy(wcs.ctype[1], "DEC--CAR");

   /* Reference pixel coordinates. */
   wcs.crpix[0] = 0.0;
   wcs.crpix[1] = 0.0;

   /* Coordinate increments. */
   wcs.cdelt[0] = -1.0;
   wcs.cdelt[1] =  1.0;

   /* Set parameters to draw the native grid. */
   wcs.crval[0] = 0.0;
   wcs.crval[1] = 0.0;

   /* Annotation. */
   strcpy(idents[0], "Right ascension");
   strcpy(idents[1], "Declination");
   strcpy(idents[2], "WCS plate caree projection");

   opt[0] = 'G';
   opt[1] = 'E';

   /* Reduced size lettering. */
   cpgsch(0.7f*scl);

   /* Draw full grid lines. */
   gcode[0] = 2;
   gcode[1] = 2;

   cpgsci(1);

   grid1[0] = 0.0;
   grid2[0] = 0.0;

   ic = -1;
   cpgsbox(blc, trc, idents, opt, 2121, 1212, c0, gcode, 0.0, 0, grid1, 0,
      grid2, 1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
      &ic, cache, &ierr);
d964 2
a965 2
   /* Draw the frame. */
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d967 1
a967 1
   cpgpage();
d970 77
a1046 77
   * Cylindrical perspective projection.
   *    - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
   *    - BLC, TRC unrelated to pixel coordinates.
   *    - Demonstrate parameter definition for PGWCSL.
   *    - Reduced size lettering.
   *    - Manual and automatic choice of coordinate increments.
   *    - Suppression of common zero minute and second fields in
   *      sexagesimal time format.
   *------------------------------------------------------------------------*/

   printf("\nCylindrical perspective projection\n");

   blc[0] = -180.0;
   blc[1] =  -90.0;
   trc[0] =  180.0;
   trc[1] =  +90.0;

   /*  Reset viewport for rectangular image. */
   if (large) {
      cpgvstd();
   } else {
      cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
   }
   cpgwnad (blc[0], trc[0], blc[1], trc[1]);

   status = wcsini(1, 2, &wcs);

   /* Set projection type to cylindrical perspective. */
   strcpy(wcs.ctype[0], "RA---CYP");
   strcpy(wcs.ctype[1], "DEC--CYP");

   /* Reference pixel coordinates. */
   wcs.crpix[0] = 0.0;
   wcs.crpix[1] = 0.0;

   /* Coordinate increments. */
   wcs.cdelt[0] = -1.0;
   wcs.cdelt[1] =  1.0;

   /* Set parameters to draw the native grid. */
   wcs.crval[0] =  45.0;
   wcs.crval[1] = -90.0;
   wcs.lonpole  = 999.0;

   /* mu and lambda projection parameters. */
   wcs.npv = 2;
   wcs.pv[0].i = 2;
   wcs.pv[0].m = 1;
   wcs.pv[0].value = 0.0;
   wcs.pv[1].i = 2;
   wcs.pv[1].m = 2;
   wcs.pv[1].value = 1.0;

   /* Annotation. */
   strcpy(idents[0], "Right ascension");
   strcpy(idents[1], "Declination");
   strcpy(idents[2], "WCS cylindrical perspective projection");

   opt[0] = 'G';
   opt[1] = 'E';

   /* Reduced size lettering. */
   cpgsch(0.7f*scl);

   /* Draw full grid lines. */
   gcode[0] = 2;
   gcode[1] = 2;

   cpgsci(1);

   grid1[0] = 0.0;
   grid2[0] = 0.0;

   ic = -1;
   cpgsbox(blc, trc, idents, opt, 2121, 1212, c0, gcode, 0.0, 0, grid1, 0,
      grid2, 1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
      &ic, cache, &ierr);
d1048 2
a1049 2
   /* Draw the frame. */
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d1051 1
a1051 1
   cpgpage();
d1054 70
a1123 70
   * Gnomonic projection.
   *    - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
   *    - Demonstrate parameter definition for PGWCSL.
   *    - Reduced size lettering.
   *    - Manual and automatic choice of coordinate increments.
   *    - Suppression of common zero minute and second fields in
   *      sexagesimal time format.
   *------------------------------------------------------------------------*/

   printf("\nTAN projection\n");

   naxis[0] = 100;
   naxis[1] = 100;

   blc[0] = 0.5;
   blc[1] = 0.5;
   trc[0] = naxis[0] + 0.5;
   trc[1] = naxis[1] + 0.5;

   /*  Reset viewport for rectangular image. */
   if (large) {
      cpgvstd();
   } else {
      cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
   }
   cpgwnad(0.0f, 1.0f, 0.0f, ((float)naxis[1])/((float)naxis[0]));

   status = wcsini(1, 2, &wcs);

   /* Set projection type to gnomonic. */
   strcpy(wcs.ctype[0], "RA---TAN");
   strcpy(wcs.ctype[1], "DEC--TAN");

   /* Reference pixel coordinates. */
   wcs.crpix[0] = 50.5;
   wcs.crpix[1] =  1.0;

   /* Coordinate increments. */
   wcs.cdelt[0] = 1e-3;
   wcs.cdelt[1] = 1e-3;

   /* Set parameters to draw the native grid. */
   wcs.crval[0] =  45.0;
   wcs.crval[1] = -89.7;
   wcs.lonpole  = 999.0;

   /* Annotation. */
   strcpy(idents[0], "Right ascension");
   strcpy(idents[1], "Declination");
   strcpy(idents[2], "WCS TAN projection");

   opt[0] = 'E';
   opt[1] = 'E';

   /* Reduced size lettering. */
   cpgsch(0.7f*scl);

   /* Draw full grid lines. */
   gcode[0] = 2;
   gcode[1] = 2;

   cpgsci(1);

   grid1[0] = 0.0;
   grid2[0] = 0.0;

   ic = -1;
   cpgsbox(blc, trc, idents, opt, 0, 1212, c0, gcode, 0.0, 0, grid1, 0,
      grid2, 0, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
      &ic, cache, &ierr);
d1125 2
a1126 2
   /* Draw the frame. */
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d1128 1
a1128 1
   cpgpage();
d1131 116
a1246 116
   * Linear-linear plot with two types of alternative labelling.
   *    - PGSBOX uses subroutine PGCRFN.
   *    - Separable (i.e. orthogonal), linear coordinate system.
   *    - Use of function PGCRFN for separable axis types.
   *    - Alternative labelling and axis annotation.
   *    - Direct manipulation of the axis-crossing table.
   *    - Tick mark and grid line control.
   *    - User selection of what edges to label.
   *    - Automatic choice of coordinate increments.
   *------------------------------------------------------------------------*/

   printf("\nLinear plot with alternative labelling\n");

   if (large) {
      cpgvstd();
   } else {
      cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
   }
   cpgwnad(0.0f, 1.0f, 0.0f, 1.0f);

   naxis[0] = 512;
   naxis[1] = 512;

   blc[0] = 0.5;
   blc[1] = 0.5;
   trc[0] = naxis[0] + 0.5;
   trc[1] = naxis[1] + 0.5;

   /* Function types. */
   strcpy(fcode[0], "Lin ");
   strcpy(fcode[1], "Lin ");

   /* Reference pixel coordinates. */
   nldprm[0] = 0.5;
   nldprm[1] = 0.5;

   /* Coordinate increments. */
   nldprm[2] = 0.03;
   nldprm[3] = 0.03;

   /* Reference pixel values. */
   nldprm[4] = 20.0;
   nldprm[5] =  0.0;

   /* Annotation. */
   strcpy(idents[0], "temperature of frog (\\uo\\dC)");
   strcpy(idents[1], "distance hopped (m)");
   strcpy(idents[2], "");

   opt[0] = ' ';
   opt[1] = ' ';

   /* Reduced size lettering. */
   cpgsch(0.8f*scl);

   /* Draw tick marks at the bottom for the first coordinate, grid lines  */
   /* for the second.  Setting GCODE[0] = -1 inhibits information being   */
   /* stored for labels on the top edge while GCODE[1] = 2 causes         */
   /* information to be stored for labels on the right edge even if those */
   /* labels are not actually produced.                                   */
   cpgsci(1);
   gcode[0] = -1;
   gcode[1] =  2;
   grid1[0] = 0.0;
   grid2[0] = 0.0;

   /* Set LABCTL = 21 to label the bottom and left edges only. */
   ic = -1;
   cpgsbox(blc, trc, idents, opt, 21, 0, c0, gcode, 2.0, 0, grid1, 0, grid2,
      0, pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache, &ierr);

   /* Information for labels on the right edge was stored in the crossing   */
   /* table on the first call to PGSBOX.  We now want to manipulate it to   */
   /* convert metres to feet.  Note that while it's a simple matter to draw */
   /* alternative sets of tick marks on opposite edges of the frame, as     */
   /* with the two temperature scales, we have the slightly more difficult  */
   /* requirement of labelling grid lines with different values at each     */
   /* end.                                                                  */
   for (j = 0; j <= ic; j++) {
      /* Look for entries associated with the right edge of the frame. */
      if (cache[j][0] == 4.0) {
         /* Convert to feet, rounding to the nearest 0.1. */
         cache[j][3] *= 1e3/(25.4*12.0);
         cache[j][3] = floor(cache[j][3]*10.0 + 0.5)/10.0;
      }
   }

   /* Annotation for the right edge. */
   strcpy(idents[0], "");
   strcpy(idents[1], "(feet)");

   /* Set LABCTL = 12000 to label the right edge with the second coordinate */
   /* without redrawing the grid lines. */
   cpgsbox(blc, trc, idents, opt, 12000, 0, c0, gcode, 2.0, 0, grid1, 0,
      grid2, 0, pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache,
      &ierr);

   /* The alternative temperature scale in Fahrenheit is to be constructed */
   /* with a new set of tick marks. */
   nldprm[2] = nldprm[2]*1.8;
   nldprm[4] = nldprm[4]*1.8 + 32.0;

   /* Draw tick marks at the top for the first coordinate, don't redo grid */
   /* lines for the second. */
   gcode[0] = -100;
   gcode[1] = 0;

   /* Annotation for the top edge. */
   strcpy(idents[0], "(\\uo\\dF)");
   strcpy(idents[1], "");

   /* Set LABCTL = 100 to label the top edge; Set IC = -1 to redetermine */
   /* the coordinate extrema. */
   ic = -1;
   cpgsbox(blc, trc, idents, opt, 100, 0, c0, gcode, 2.0, 0, grid1, 0, grid2,
      0, pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache, &ierr);
d1248 2
a1249 2
   /* Draw the frame. */
   cpgbox("bc", 0.0f, 0, "bc", 0.0f, 0);
d1251 1
a1251 1
   cpgpage();
d1254 35
a1288 35
   * Calendar axes using subroutine PGLBOX.
   *    - Separable (i.e. orthogonal), linear coordinate system.
   *    - Use of PGLBOX for simple linear axis types.
   *    - Automatic choice of what edges to label; results in labelling
   *      the bottom and left sides of the plot.
   *    - Automatic choice of coordinate increments.
   *    - Calendar date axis labelling.
   *    - Single-character annotation on a vertical axis is upright.
   *------------------------------------------------------------------------*/

   printf("\nCalendar axes using subroutine PGLBOX\n");

   cpgswin(51900.0f, 52412.0f, 51900.0f, 57020.0f);

   /* Annotation. */
   strcpy(idents[0], "Date started");
   strcpy(idents[1], "Date finished");
   strcpy(idents[2], "Calendar axes using subroutine PGLBOX");

   opt[0] = 'Y';
   opt[1] = 'Y';

   /* Reduced size lettering. */
   cpgsch(0.7f*scl);

   /* Draw tick marks on each axis. */
   cpgsci(1);
   gcode[0] = 1;
   gcode[1] = 1;
   grid1[0] = 0.0;
   grid2[0] = 0.0;

   ic = -1;
   cpglbox(idents, opt, 0, 0, c0, gcode, 2.0, 0, grid1, 0, grid2, 0, 256, &ic,
      cache, &ierr);
d1290 2
a1291 2
   /* Draw the frame. */
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d1293 1
a1293 1
   cpgpage();
d1296 59
a1354 59
   * Simple linear axes handled by PGWCSL.
   *    - Separable (i.e. orthogonal), linear coordinate system.
   *    - Automatic choice of what edges to label; results in labelling
   *      the bottom and left sides of the plot.
   *    - Automatic choice of coordinate increments.
   *    - Tick marks and labels at the edges of the frame.
   *    - Single-character annotation on a vertical axis is upright.
   *------------------------------------------------------------------------*/

   printf("\nSimple linear axes handled by pgwcsl()\n");

   naxis[0] = 3;
   naxis[1] = 3;

   blc[0] = 0.5;
   blc[1] = 0.5;
   trc[0] = naxis[0] + 0.5;
   trc[1] = naxis[1] + 0.5;

   status = wcsini(1, 2, &wcs);

   strcpy(wcs.ctype[0], "x");
   strcpy(wcs.ctype[1], "y");

   /* Reference pixel coordinates. */
   wcs.crpix[0] = 2.0;
   wcs.crpix[1] = 2.0;

   /* Coordinate increments. */
   wcs.cdelt[0] = 1.0;
   wcs.cdelt[1] = 1.0;

   /* Spherical coordinate references. */
   wcs.crval[0] = 2.0;
   wcs.crval[1] = 2.0;

   /* Annotation. */
   strcpy(idents[0], "X");
   strcpy(idents[1], "Y");
   strcpy(idents[2], "Simple linear axes handled by pgwcsl()");

   opt[0] = ' ';
   opt[1] = ' ';

   /* Reduced size lettering. */
   cpgsch(0.8f*scl);

   /* Draw full grid lines. */
   cpgsci(1);
   gcode[0] = 1;
   gcode[1] = 1;

   grid1[0] = 0.0;
   grid2[0] = 0.0;

   ic = -1;
   cpgsbox(blc, trc, idents, opt, 0, 0, c0, gcode, 2.0, 0, grid1, 0, grid2,
      0, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
      cache, &ierr);
d1356 2
a1357 2
   /* Draw the frame. */
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d1359 1
a1359 1
   cpgpage();
d1363 1
a1363 1
   wcsfree(&wcs);
d1365 2
a1366 2
   cpgask(0);
   cpgend();
d1368 1
a1368 1
   return 0;
@


4.3.1.1
log
@PGSBOX 4.3 development branch.
@
text
@d3 2
a4 2
    PGSBOX 4.4 - an implementation of the FITS WCS standard.
    Copyright (C) 1997-2008, Mark Calabretta
d31 1
a31 1
    $Id: cpgtest.c,v 4.3 2007/12/27 05:49:14 cal103 Exp cal103 $
@


4.3.1.2
log
@Changed indentation.
@
text
@d3 2
a4 2
  PGSBOX 4.4 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2009, Mark Calabretta
d6 1
a6 1
  This file is part of PGSBOX.
d8 24
a31 24
  PGSBOX is free software: you can redistribute it and/or modify it under the
  terms of the GNU Lesser General Public License as published by the Free
  Software Foundation, either version 3 of the License, or (at your option)
  any later version.

  PGSBOX is distributed in the hope that it will be useful, but WITHOUT ANY
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
  more details.

  You should have received a copy of the GNU Lesser General Public License
  along with PGSBOX.  If not, see <http://www.gnu.org/licenses/>.

  Correspondence concerning PGSBOX may be directed to:
    Internet email: mcalabre@@atnf.csiro.au
    Postal address: Dr. Mark Calabretta
                    Australia Telescope National Facility, CSIRO
                    PO Box 76
                    Epping NSW 1710
                    AUSTRALIA

  Author: Mark Calabretta, Australia Telescope National Facility
  http://www.atnf.csiro.au/~mcalabre/index.html
  $Id: cpgtest.c,v 4.3.1.1 2007/12/27 13:26:31 cal103 Exp cal103 $
d57 2
a58 2
  const double pi = 3.141592653589793238462643;
  const double d2r = pi/180.0;
d60 64
a123 64
  char   devtyp[16], fcode[2][4], idents[3][80], nlcprm[1], opt[2];
  int    c0[7], ci[7], gcode[2], ic, ierr, j, large, naxis[2], nliprm[2],
         status;
  float  blc[2], scl, trc[2];
  double cache[257][4], dec0, grid1[9], grid2[9], nldprm[8], rotn, tiklen;
  struct wcsprm wcs;
  nlfunc_t lngvel_, fscan_, pgcrfn_, pgwcsl_;

  /* Setup. */
  naxis[0] = 512;
  naxis[1] = 512;

  blc[0] = 0.5f;
  blc[1] = 0.5f;
  trc[0] = naxis[0] + 0.5f;
  trc[1] = naxis[1] + 0.5f;

  strcpy(devtyp, "/XWINDOW");
  cpgbeg(0, devtyp, 1, 1);

  j = 16;
  cpgqinf("TYPE", devtyp, &j);
  if (strcmp(devtyp, "PS") == 0  ||
     strcmp(devtyp, "VPS") == 0 ||
     strcmp(devtyp, "CPS") == 0 ||
     strcmp(devtyp, "VCPS") == 0) {
    /* Switch black and white. */
    cpgscr(0, 1.0f, 1.0f, 1.0f);
    cpgscr(1, 0.0f, 0.0f, 0.0f);
  }

  large = strcmp(devtyp, "XWINDOW") == 0;
  if (large) {
    scl = 1.0f;
    cpgvstd();
  } else {
    scl = 0.7f;
    cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
  }

  /* Yellow. */
  cpgscr(2, 1.0f, 1.0f, 0.0f);
  /* White. */
  cpgscr(3, 1.0f, 1.0f, 1.0f);
  /* Pale blue. */
  cpgscr(4, 0.5f, 0.5f, 0.8f);
  /* Pale red. */
  cpgscr(5, 0.8f, 0.5f, 0.5f);
  /* Grey. */
  cpgscr(6, 0.7f, 0.7f, 0.7f);
  /* Dark green. */
  cpgscr(7, 0.3f, 0.5f, 0.3f);

  c0[0] = -1;
  c0[1] = -1;
  c0[2] = -1;
  c0[3] = -1;
  c0[4] = -1;
  c0[5] = -1;
  c0[6] = -1;

  cpgwnad(0.0f, 1.0f, 0.0f, 1.0f);
  cpgask(1);
  cpgpage();
d125 1
a125 1
  wcs.flag = -1;
d128 64
a191 64
  * Longitude-velocity map; the y-axis is regularly spaced in frequency but is
  * to be labelled as a true relativistic velocity.
  *   - PGSBOX uses subroutine LNGVEL.
  *   - Separable (i.e. orthogonal), non-linear coordinate system.
  *   - Automatic choice of coordinate increments.
  *   - Extraction of a common scaling factor.
  *   - Automatic choice of what edges to label.
  *   - Request for tickmarks (internal) for one coordinate and grid lines
  *     for the other.
  *   - Simple two-colour grid using two calls with deferred labelling on
  *     the first call.
  *   - Degree labelling.
  *   - Suppression of zero arcmin and arcsec fields in sexagesimal degree
  *     format.
  *------------------------------------------------------------------------*/

  printf("\nLongitude-velocity map\n");

  /* Reference pixel coordinates. */
  nldprm[0] =   1.0;
  nldprm[1] = 256.0;

  /* Reference pixel values. */
  nldprm[2] = 0.0;
  nldprm[3] = 1.420e9;

  /* Coordinate increments. */
  nldprm[4] = 360.0/(naxis[0]-1);
  nldprm[5] = 4e6;

  /* Rest frequency. */
  nldprm[6] = 1.420e9;

  /* Annotation. */
  strcpy(idents[0], "galactic longitude");
  strcpy(idents[1], "velocity (m/s)");
  strcpy(idents[2], "HI line");

  opt[0] = 'F';
  opt[1] = ' ';

  /* Normal size lettering. */
  cpgsch(1.0f*scl);

  /* Yellow tick marks for longitude and grid lines for velocity. */
  cpgsci(2);
  gcode[0] = 1;
  gcode[1] = 2;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  /* Defer labelling. */
  ic = -1;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 2.0, 0, grid1, 0, grid2,
    0, lngvel_, 1, 1, 7, nlcprm, nliprm, nldprm, 256, &ic, cache, &ierr);

  /* Draw fiducial grid lines in white and do labelling. */
  cpgsci(1);
  gcode[0] = 2;
  gcode[1] = 2;
  grid1[1] = 180.0;
  grid2[1] = 0.0;
  cpgsbox(blc, trc, idents, opt, 0, 0, c0, gcode, 0.0, 1, grid1, 1, grid2,
    0, lngvel_, 1, 1, 7, nlcprm, nliprm, nldprm, 256, &ic, cache, &ierr);
d193 2
a194 2
  /* Draw the frame. */
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d196 1
a196 1
  cpgpage();
d199 57
a255 57
  * Azimuth-frequency scan; this sort of output might be obtained from an
  * antenna that scans in azimuth with a receiver that scans simultaneously
  * in frequency.
  *   - PGSBOX uses subroutine FSCAN.
  *   - Non-separable (i.e. non-orthogonal) non-linear coordinate system.
  *   - Automatic choice of what edges to label; results in labelling the
  *     bottom, left and right sides of the plot.
  *   - Cyclic labelling.  FSCAN returns the azimuth in the range
  *     0 - 720 degrees but PGSBOX is set to normalize this to two cycles of
  *     0 - 360 degrees.
  *   - Logarithmic labelling.
  *   - Automatic choice of coordinate increments but with request for all
  *     grid lines for the logarithmic coordinate.
  *   - Degree labelling.
  *   - Suppression of common zero arcmin and arcsec fields in sexagesimal
  *     degree format.
  *------------------------------------------------------------------------*/

  printf("\nAzimuth-frequency scan\n");

  /* Reference pixel coordinates. */
  nldprm[0] = 0.5;
  nldprm[1] = 0.5;

  /* Reference pixel values. */
  nldprm[2] = 0.0;
  nldprm[3] = 8.5;

  /* Coordinate increments. */
  nldprm[4] = 720.0/(naxis[0]+1);
  nldprm[5] = 0.002;

  /* Rate of change of NLDPRM[3] with x-pixel. */
  nldprm[6] = -0.002;

  /* Annotation. */
  strcpy(idents[0], "azimuth");
  strcpy(idents[1], "\\gn/Hz");
  strcpy(idents[2], "Frequency/azimuth scan");

  opt[0] = 'D';
  opt[1] = 'L';

  /* Normal size lettering. */
  cpgsch(1.0f*scl);

  /* Draw full grid lines. */
  cpgsci(1);
  gcode[0] = 2;
  gcode[1] = 2;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  /* Setting labden = 9900 forces all logarithmic grid lines to be drawn. */
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 0, 9900, c0, gcode, 2.0, 0, grid1, 0, grid2,
    0, fscan_, 1, 1, 7, nlcprm, nliprm, nldprm, 256, &ic, cache, &ierr);
d257 2
a258 2
  /* Draw the frame. */
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d260 1
a260 1
  cpgpage();
d264 50
a313 50
  * Z versus time plot.
  *   - PGSBOX uses subroutine PGCRFN.
  *   - Separable (i.e. orthogonal), non-linear coordinate system.
  *   - Use of function PGCRFN for separable axis types.
  *   - Automatic choice of what edges to label; results in labelling the
  *     bottom and left sides of the plot.
  *   - Automatic choice of coordinate increments.
  *   - Logarithmic labelling over many orders of magnitude.
  *   - Single-character annotation on a vertical axis is upright.
  *------------------------------------------------------------------------*/

  printf("\nZ versus time plot\n");

  /* Function types. */
  strcpy(fcode[0], "Lin ");
  strcpy(fcode[1], "Log ");

  /* Reference pixel coordinates. */
  nldprm[0] =   0.5;
  nldprm[1] = -50.0;

  /* Coordinate increments. */
  nldprm[2] = 0.04;
  nldprm[3] = 0.02;

  /* Reference pixel values. */
  nldprm[4] = -3.0;
  nldprm[5] =  1.0;

  /* Annotation. */
  strcpy(idents[0], "Age of universe (sec)");
  strcpy(idents[1], "Y");
  strcpy(idents[2], "");

  opt[0] = 'L';
  opt[1] = ' ';

  /* Normal size lettering. */
  cpgsch(1.0f*scl);

  /* Draw ticks for the first coordinate, grid lines for the second. */
  cpgsci(1);
  gcode[0] = 1;
  gcode[1] = 2;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, 0, 0, c0, gcode, 2.0, 0, grid1, 0, grid2, 0,
    pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache, &ierr);
d315 2
a316 2
  /* Draw the frame. */
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d318 1
a318 1
  cpgpage();
d321 75
a395 75
  * Simple SIN projection near the south celestial pole.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Discovery of grid lines that do not cross any axis.
  *   - Automatic choice of what edges to label; results in labelling all
  *     sides of the plot.
  *   - Automatic choice of coordinate increments but with request for
  *     increased grid density for each coordinate.
  *   - Double precision accuracy.
  *   - Cyclic coordinates.  PGWCSL returns the right ascension in the range
  *     -180 to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
  *   - Labelling of degrees as time in the range 0 - 24h.
  *   - Suppression of labels that would overlap one another.
  *   - Sexagesimal degree labelling with automatically determined
  *     precision.
  *   - Suppression of common zero minute and second fields in sexagesimal
  *     time format.
  *------------------------------------------------------------------------*/

  printf("\nSimple SIN projection\n");

  wcs.flag = -1;
  status = wcsini(1, 2, &wcs);

  /* Set projection type to SIN. */
  strcpy(wcs.ctype[0], "RA---SIN");
  strcpy(wcs.ctype[1], "DEC--SIN");

  /* Reference pixel coordinates. */
  wcs.crpix[0] = 384.0;
  wcs.crpix[1] = 256.0;

  /* Coordinate increments. */
  wcs.cdelt[0] = -1.0/3600000.0;
  wcs.cdelt[1] =  1.0/3600000.0;

  /* Spherical coordinate references. */
  dec0 = -89.99995;
  wcs.crval[0] = 25.0;
  wcs.crval[1] = dec0;

  /* Set parameters for an NCP projection. */
  dec0 *= d2r;
  wcs.pv[0].i = 2;
  wcs.pv[0].m = 1;
  wcs.pv[0].value = 0.0;
  wcs.pv[0].i = 2;
  wcs.pv[1].m = 2;
  wcs.pv[1].value = cos(dec0)/sin(dec0);

  /* Annotation. */
  strcpy(idents[0], "Right ascension");
  strcpy(idents[1], "Declination");
  strcpy(idents[2], "WCS SIN projection");

  opt[0] = 'G';
  opt[1] = 'E';

  /* Compact lettering. */
  cpgsch(0.8f*scl);

  /* Draw full grid lines. */
  cpgsci(1);
  gcode[0] = 2;
  gcode[1] = 2;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  /* Draw the celestial grid.  The grid density is set for each world */
  /* coordinate by specifying LABDEN = 1224. */
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 0, 1224, c0, gcode, 0.0, 0, grid1, 0, grid2,
    0, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);
d397 2
a398 2
  /* Draw the frame. */
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d400 1
a400 1
  cpgpage();
d403 118
a520 118
  * Conic equal area projection.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  *   - Coordinate system undefined in areas of the plot.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Discontinuous grid lines handled by PGWCSL.
  *   - Discovery of grid lines that do not cross any axis.
  *   - Colour control for grid and labelling.
  *   - Reduced size lettering.
  *   - Automatic choice of what edges to label; results in labelling all
  *     sides of the plot.
  *   - Automatic choice of coordinate increments.
  *   - Cyclic coordinates.  PGWCSL returns the longitude in the range -180
  *     to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
  *   - Suppression of labels that would overlap one another.
  *   - Suppression of common zero arcmin and arcsec fields in sexagesimal
  *     degree format.
  *------------------------------------------------------------------------*/

  printf("\nConic equal area projection\n");

  status = wcsini(1, 2, &wcs);

  /* Set projection type to conic equal-area. */
  strcpy(wcs.ctype[0], "RA---COE");
  strcpy(wcs.ctype[1], "DEC--COE");

  /* Reference pixel coordinates. */
  wcs.crpix[0] = 256.0;
  wcs.crpix[1] = 256.0;

  /* Coordinate increments. */
  wcs.cdelt[0] = -1.0/3.0;
  wcs.cdelt[1] =  1.0/3.0;

  /* Spherical coordinate references. */
  wcs.crval[0] =  90.0;
  wcs.crval[1] =  30.0;
  wcs.lonpole  = 150.0;

  /* Middle latitude and offset from standard parallels. */
  wcs.npv = 2;
  wcs.pv[0].i = 2;
  wcs.pv[0].m = 1;
  wcs.pv[0].value = 60.0;
  wcs.pv[1].i = 2;
  wcs.pv[1].m = 2;
  wcs.pv[1].value = 15.0;

  /* Annotation. */
  strcpy(idents[0], "longitude");
  strcpy(idents[1], "latitude");
  strcpy(idents[2], "WCS conic equal area projection");

  opt[0] = 'E';
  opt[1] = 'E';

  /* Reduced size lettering. */
  cpgsch(0.8f*scl);

  /* Draw full grid lines. */
  gcode[0] = 2;
  gcode[1] = 2;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  /* Use colour to associate grid lines and labels. */
  /* Meridians in red. */
  cpgscr(10, 0.5f, 0.0f, 0.0f);
  /* Parallels in blue. */
  cpgscr(11, 0.0f, 0.2f, 0.5f);
  /* Longitudes in red. */
  cpgscr(12, 0.8f, 0.3f, 0.0f);
  /* Latitudes in blue. */
  cpgscr(13, 0.0f, 0.4f, 0.7f);
  /* Longitude labels in red. */
  cpgscr(14, 0.8f, 0.3f, 0.0f);
  /* Latitude labels in blue. */
  cpgscr(15, 0.0f, 0.4f, 0.7f);
  /* Title in cyan. */
  cpgscr(16, 0.3f, 1.0f, 1.0f);

  ci[0] = 10;
  ci[1] = 11;
  ci[2] = 12;
  ci[3] = 13;
  ci[4] = 14;
  ci[5] = 15;
  ci[6] = 16;

  /* Draw the celestial grid letting PGSBOX choose the increments. */
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 0, 0, ci, gcode, 0.0, 0, grid1, 0, grid2, 1,
    pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic, cache,
    &ierr);

  /* Set parameters to draw the native grid. */
  wcs.crval[0] =   0.0;
  wcs.crval[1] =  60.0;
  wcs.lonpole  = 999.0;
  wcs.latpole  = 999.0;
  status = wcsset(&wcs);

  /* We just want to delineate the boundary, in green. */
  cpgsci(7);
  grid1[1] = -180.0;
  grid1[2] =  180.0;
  grid2[1] =  -90.0;
  grid2[2] =   90.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 2, grid1, 2, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  /* Draw the frame. */
  cpgsci(1);
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d522 1
a522 1
  cpgpage();
d525 206
a730 206
  * Polyconic projection with colour-coded grid.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  *   - Coordinate system undefined in areas of the plot.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Discontinuous grid lines handled by PGWCSL.
  *   - Colour coded labelling.
  *   - Colour coded grid implemented by the caller.
  *   - Basic management of the axis-crossing table (see code).
  *   - Reduced size lettering.
  *   - Tick marks external to the frame.
  *   - User selection of what edges to label with request for both
  *     coordinates to be labelled on bottom, left and top edges.
  *   - User selection of grid lines to plot.
  *   - Concatenation of annotation at bottom and left; automatically
  *     suppressed at the top since only one coordinate is labelled there.
  *   - Suppression of labels that would overlap one another.
  *   - Degree labelling.
  *   - Labelling of degrees as time in the range -12 - +12h.
  *   - Suppression of common zero minute and second fields in sexagesimal
  *     time format.
  *------------------------------------------------------------------------*/

  printf("\nPolyconic projection with colour-coded grid\n");

  status = wcsini(1, 2, &wcs);

  /* Set projection type to polyconic. */
  strcpy(wcs.ctype[0], "RA---PCO");
  strcpy(wcs.ctype[1], "DEC--PCO");

  /* Reference pixel coordinates. */
  wcs.crpix[0] = 192.0;
  wcs.crpix[1] = 640.0;

  /* Rotate 30 degrees. */
  rotn = 30.0*d2r;
  *(wcs.pc)   =  cos(rotn);
  *(wcs.pc+1) =  sin(rotn);
  *(wcs.pc+2) = -sin(rotn);
  *(wcs.pc+3) =  cos(rotn);

  /* Coordinate increments. */
  wcs.cdelt[0] = -1.0/5.0;
  wcs.cdelt[1] =  1.0/5.0;

  /* Spherical coordinate references. */
  wcs.crval[0] = 332.0;
  wcs.crval[1] =  40.0;
  wcs.lonpole  = -30.0;

  /* Annotation. */
  strcpy(idents[0], "Hour angle");
  strcpy(idents[1], "Declination");
  strcpy(idents[2], "WCS polyconic projection");

  opt[0] = 'H';
  opt[1] = 'B';

  /* Reduced size lettering. */
  cpgsch(0.9f*scl);

  /* Draw external (TIKLEN < 0) tick marks every 5 degrees. */
  gcode[0] = 1;
  gcode[1] = 1;
  tiklen = -2.0;

  cpgsci(6);
  grid1[0] = 5.0;
  grid2[0] = 5.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, tiklen, 0, grid1, 0,
    grid2, 1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
    &ic, cache, &ierr);

  /* Resetting the table index to zero causes information about the */
  /* tick marks to be discarded. */
  ic = 0;

  /* Draw full grid lines in yellow rather than tick marks. */
  cpgsci(2);
  gcode[0] = 2;
  gcode[1] = 2;

  /* Draw the primary meridian and equator. */
  grid1[1] = 0.0;
  grid2[1] = 0.0;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 1, grid1, 1, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  /* At this point the axis-crossing table will have entries for the  */
  /* primary meridian and equator.  Labelling was deferred in the     */
  /* previous call, and the table is passed intact on the second call */
  /* to accumulate further axis-crossings.                            */

  /* Draw 90 degree meridians and poles in white. */
  cpgsci(3);
  grid1[1] =  90.0;
  grid1[2] = 180.0;
  grid1[3] = 270.0;
  grid2[1] = -90.0;
  grid2[2] =  90.0;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 3, grid1, 2, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  /* Draw the first set of 15 degree meridians and parallels in blue. */
  cpgsci(4);
  grid1[1] =  15.0;
  grid1[2] =  60.0;
  grid1[3] = 105.0;
  grid1[4] = 150.0;
  grid1[5] = 195.0;
  grid1[6] = 240.0;
  grid1[7] = 285.0;
  grid1[8] = 330.0;
  grid2[1] = -75.0;
  grid2[2] = -30.0;
  grid2[3] =  15.0;
  grid2[4] =  60.0;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 8, grid1, 4, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  /* Draw the second set of 15 degree meridians and parallels in red. */
  cpgsci(5);
  grid1[1] =  30.0;
  grid1[2] =  75.0;
  grid1[3] = 120.0;
  grid1[4] = 165.0;
  grid1[5] = 210.0;
  grid1[6] = 255.0;
  grid1[7] = 300.0;
  grid1[8] = 345.0;
  grid2[1] = -60.0;
  grid2[2] = -15.0;
  grid2[3] =  30.0;
  grid2[4] =  75.0;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 8, grid1, 4, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  /* The axis-crossing table has now accumulated information for all of */
  /* the preceding meridians and parallels but no labels have been      */
  /* produced.  It will acquire information for the the next set of     */
  /* meridians and parallels before being processed by this call to     */
  /* PGSBOX which finally produces the labels.                          */

  /* Draw the 45 degree meridians and parallels in grey and use colour  */
  /* to differentiate grid labels. */
  /* Meridians and parallels in grey. */
  cpgscr(10, 0.7f, 0.7f, 0.7f);
  cpgscr(11, 0.7f, 0.7f, 0.7f);
  /* Longitudes tinged red. */
  cpgscr(12, 1.0f, 0.9f, 0.6f);
  /* Latitudes tinged green. */
  cpgscr(13, 0.8f, 1.0f, 0.9f);
  /* Longitude labels tinged red. */
  cpgscr(14, 1.0f, 0.9f, 0.6f);
  /* Latitude labels tinged green. */
  cpgscr(15, 0.8f, 1.0f, 0.9f);
  /* Title in white. */
  cpgscr(16, 1.0f, 1.0f, 1.0f);

  ci[0] = 10;
  ci[1] = 11;
  ci[2] = 12;
  ci[3] = 13;
  ci[4] = 14;
  ci[5] = 15;
  ci[6] = 16;

  cpgsci(6);

  /* Tell PGSBOX what edges to label. */
  grid1[1] =  45.0;
  grid1[2] = 135.0;
  grid1[3] = 225.0;
  grid1[4] = 315.0;
  grid2[1] = -45.0;
  grid2[2] =  45.0;
  cpgsbox(blc, trc, idents, opt, 2333, 0, ci, gcode, 0.0, 4, grid1, 2, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  /* Native grid in green (delineates boundary). */
  cpgsci(7);
  grid1[1] = -180.0;
  grid1[2] =  180.0;
  grid2[1] = -999.0;

  wcs.crval[0] =   0.0;
  wcs.crval[1] =   0.0;
  wcs.lonpole  = 999.0;
  status = wcsset(&wcs);

  ic = -1;
  cpgsbox(blc, trc, idents, opt, -1, 0, c0, gcode, 0.0, 2, grid1, 1, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  /* Draw the frame. */
  cpgsci(1);
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d732 1
a732 1
  cpgpage();
d735 156
a890 156
  * Plate Carree projection.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - Rectangular image.
  *   - Dual coordinate grids.
  *   - Non-separable (i.e. non-orthogonal) curvilinear coordinate system.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Discontinuous grid lines handled by PGWCSL.
  *   - Colour coding of grid and labelling.
  *   - Reduced size lettering.
  *   - Manual labelling control.
  *   - Manual and automatic choice of coordinate increments.
  *   - Cyclic coordinates.  PGWCSL returns the longitude in the range -180
  *     to +180 degrees, i.e. with a discontinuity at +/- 180 degrees.
  *   - Suppression of labels that would overlap one another.
  *------------------------------------------------------------------------*/

  printf("\nPlate Carree projection\n");

  naxis[0] = 181;
  naxis[1] =  91;

  blc[0] = 0.5;
  blc[1] = 0.5;
  trc[0] = naxis[0] + 0.5;
  trc[1] = naxis[1] + 0.5;

  /* Reset viewport for rectangular image. */
  if (large) {
    cpgvstd();
  } else {
    cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
  }
  cpgwnad(0.0f, 1.0f, 0.0f, ((float)naxis[1])/((float)naxis[0]));

  status = wcsini(1, 2, &wcs);

  /* Set projection type to plate carree. */
  strcpy(wcs.ctype[0], "GLON-CAR");
  strcpy(wcs.ctype[1], "GLAT-CAR");

  /* Reference pixel coordinates. */
  wcs.crpix[0] = 226.0;
  wcs.crpix[1] =  46.0;

  /* Linear transformation matrix. */
  rotn = 15.0*d2r;
  *(wcs.pc)   =  cos(rotn);
  *(wcs.pc+1) =  sin(rotn);
  *(wcs.pc+2) = -sin(rotn);
  *(wcs.pc+3) =  cos(rotn);

  /* Coordinate increments. */
  wcs.cdelt[0] = -1.0;
  wcs.cdelt[1] =  1.0;

  /* Set parameters to draw the native grid. */
  wcs.crval[0] = 0.0;
  wcs.crval[1] = 0.0;

  /* The reference pixel was defined so that the native longitude runs   */
  /* from 225 deg to 45 deg and this will cause the grid to be truncated */
  /* at the 180 deg boundary.  However, being a cylindrical projection   */
  /* it is possible to recentre it in longitude.  cylfix() will modify   */
  /* modify CRPIX, CRVAL, and LONPOLE to suit.                           */

  status = cylfix(naxis, &wcs);

  /* Annotation. */
  strcpy(idents[0], "");
  strcpy(idents[1], "");
  strcpy(idents[2], "WCS plate caree projection");

  opt[0] = 'C';
  opt[1] = 'C';

  /* Reduced size lettering. */
  cpgsch(0.8f*scl);

  /* Draw full grid lines. */
  gcode[0] = 2;
  gcode[1] = 2;

  /* Draw native grid in green. */
  cpgscr(16, 0.0f, 0.2f, 0.0f);
  /* Title in cyan. */
  cpgscr(17, 0.3f, 1.0f, 1.0f);

  ci[0] = 16;
  ci[1] = 16;
  ci[2] =  7;
  ci[3] =  7;
  ci[4] = -1;
  ci[5] = -1;
  ci[6] = 17;

  grid1[0] = 15.0;
  grid2[0] = 15.0;
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 2100, 0, ci, gcode, 0.0, 0, grid1, 0, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  /* Reset CRPIX previously modified by cylfix(). */
  wcs.crpix[0] = 226.0;
  wcs.crpix[1] =  46.0;

  /* Galactic reference coordinates. */
  wcs.crval[0] =  30.0;
  wcs.crval[1] =  35.0;
  wcs.lonpole  = 999.0;
  status = wcsset(&wcs);

  status = cylfix(naxis, &wcs);

  /* Annotation. */
  strcpy(idents[0], "longitude");
  strcpy(idents[1], "latitude");
  strcpy(idents[2], "");

  opt[0] = 'E';
  opt[1] = 'E';

  /* Use colour to associate grid lines and labels. */
  /* Meridians in red. */
  cpgscr(10, 0.5f, 0.0f, 0.0f);
  /* Parallels in blue. */
  cpgscr(11, 0.0f, 0.2f, 0.5f);
  /* Longitudes in red. */
  cpgscr(12, 0.8f, 0.3f, 0.0f);
  /* Latitudes in blue. */
  cpgscr(13, 0.0f, 0.4f, 0.7f);
  /* Longitude labels in red. */
  cpgscr(14, 0.8f, 0.3f, 0.0f);
  /* Latitude labels in blue. */
  cpgscr(15, 0.0f, 0.4f, 0.7f);

  ci[0] = 10;
  ci[1] = 11;
  ci[2] = 12;
  ci[3] = 13;
  ci[4] = 14;
  ci[5] = 15;
  ci[6] = -1;

  grid1[0] = 0.0;
  grid2[0] = 0.0;

  /* Draw the celestial grid letting PGSBOX choose the increments. */
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 21, 0, ci, gcode, 0.0, 0, grid1, 0, grid2,
    1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);

  /* Draw the frame. */
  cpgsci(1);
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d892 1
a892 1
  cpgpage();
d895 68
a962 68
  * Plate Carree projection.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - BLC, TRC unrelated to pixel coordinates.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Poles and 180 meridian projected along edges of the frame.
  *   - Reduced size lettering.
  *   - Manual and automatic choice of coordinate increments.
  *   - Suppression of common zero minute and second fields in sexagesimal
  *     time format.
  *------------------------------------------------------------------------*/

  printf("\nPlate Carree projection\n");

  blc[0] = -180.0;
  blc[1] =  -90.0;
  trc[0] =  180.0;
  trc[1] =  +90.0;

  /*  Reset viewport for rectangular image. */
  if (large) {
    cpgvstd();
  } else {
    cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
  }
  cpgwnad (blc[0], trc[0], blc[1], trc[1]);

  status = wcsini(1, 2, &wcs);

  /* Set projection type to plate carree. */
  strcpy(wcs.ctype[0], "RA---CAR");
  strcpy(wcs.ctype[1], "DEC--CAR");

  /* Reference pixel coordinates. */
  wcs.crpix[0] = 0.0;
  wcs.crpix[1] = 0.0;

  /* Coordinate increments. */
  wcs.cdelt[0] = -1.0;
  wcs.cdelt[1] =  1.0;

  /* Set parameters to draw the native grid. */
  wcs.crval[0] = 0.0;
  wcs.crval[1] = 0.0;

  /* Annotation. */
  strcpy(idents[0], "Right ascension");
  strcpy(idents[1], "Declination");
  strcpy(idents[2], "WCS plate caree projection");

  opt[0] = 'G';
  opt[1] = 'E';

  /* Reduced size lettering. */
  cpgsch(0.7f*scl);

  /* Draw full grid lines. */
  gcode[0] = 2;
  gcode[1] = 2;

  cpgsci(1);

  grid1[0] = 0.0;
  grid2[0] = 0.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, 2121, 1212, c0, gcode, 0.0, 0, grid1, 0,
    grid2, 1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
    &ic, cache, &ierr);
d964 2
a965 2
  /* Draw the frame. */
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d967 1
a967 1
  cpgpage();
d970 77
a1046 77
  * Cylindrical perspective projection.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - BLC, TRC unrelated to pixel coordinates.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Reduced size lettering.
  *   - Manual and automatic choice of coordinate increments.
  *   - Suppression of common zero minute and second fields in sexagesimal
  *     time format.
  *------------------------------------------------------------------------*/

  printf("\nCylindrical perspective projection\n");

  blc[0] = -180.0;
  blc[1] =  -90.0;
  trc[0] =  180.0;
  trc[1] =  +90.0;

  /*  Reset viewport for rectangular image. */
  if (large) {
    cpgvstd();
  } else {
    cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
  }
  cpgwnad (blc[0], trc[0], blc[1], trc[1]);

  status = wcsini(1, 2, &wcs);

  /* Set projection type to cylindrical perspective. */
  strcpy(wcs.ctype[0], "RA---CYP");
  strcpy(wcs.ctype[1], "DEC--CYP");

  /* Reference pixel coordinates. */
  wcs.crpix[0] = 0.0;
  wcs.crpix[1] = 0.0;

  /* Coordinate increments. */
  wcs.cdelt[0] = -1.0;
  wcs.cdelt[1] =  1.0;

  /* Set parameters to draw the native grid. */
  wcs.crval[0] =  45.0;
  wcs.crval[1] = -90.0;
  wcs.lonpole  = 999.0;

  /* mu and lambda projection parameters. */
  wcs.npv = 2;
  wcs.pv[0].i = 2;
  wcs.pv[0].m = 1;
  wcs.pv[0].value = 0.0;
  wcs.pv[1].i = 2;
  wcs.pv[1].m = 2;
  wcs.pv[1].value = 1.0;

  /* Annotation. */
  strcpy(idents[0], "Right ascension");
  strcpy(idents[1], "Declination");
  strcpy(idents[2], "WCS cylindrical perspective projection");

  opt[0] = 'G';
  opt[1] = 'E';

  /* Reduced size lettering. */
  cpgsch(0.7f*scl);

  /* Draw full grid lines. */
  gcode[0] = 2;
  gcode[1] = 2;

  cpgsci(1);

  grid1[0] = 0.0;
  grid2[0] = 0.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, 2121, 1212, c0, gcode, 0.0, 0, grid1, 0,
    grid2, 1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
    &ic, cache, &ierr);
d1048 2
a1049 2
  /* Draw the frame. */
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d1051 1
a1051 1
  cpgpage();
d1054 70
a1123 70
  * Gnomonic projection.
  *   - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
  *   - Demonstrate parameter definition for PGWCSL.
  *   - Reduced size lettering.
  *   - Manual and automatic choice of coordinate increments.
  *   - Suppression of common zero minute and second fields in sexagesimal
  *     time format.
  *------------------------------------------------------------------------*/

  printf("\nTAN projection\n");

  naxis[0] = 100;
  naxis[1] = 100;

  blc[0] = 0.5;
  blc[1] = 0.5;
  trc[0] = naxis[0] + 0.5;
  trc[1] = naxis[1] + 0.5;

  /*  Reset viewport for rectangular image. */
  if (large) {
    cpgvstd();
  } else {
    cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
  }
  cpgwnad(0.0f, 1.0f, 0.0f, ((float)naxis[1])/((float)naxis[0]));

  status = wcsini(1, 2, &wcs);

  /* Set projection type to gnomonic. */
  strcpy(wcs.ctype[0], "RA---TAN");
  strcpy(wcs.ctype[1], "DEC--TAN");

  /* Reference pixel coordinates. */
  wcs.crpix[0] = 50.5;
  wcs.crpix[1] =  1.0;

  /* Coordinate increments. */
  wcs.cdelt[0] = 1e-3;
  wcs.cdelt[1] = 1e-3;

  /* Set parameters to draw the native grid. */
  wcs.crval[0] =  45.0;
  wcs.crval[1] = -89.7;
  wcs.lonpole  = 999.0;

  /* Annotation. */
  strcpy(idents[0], "Right ascension");
  strcpy(idents[1], "Declination");
  strcpy(idents[2], "WCS TAN projection");

  opt[0] = 'E';
  opt[1] = 'E';

  /* Reduced size lettering. */
  cpgsch(0.7f*scl);

  /* Draw full grid lines. */
  gcode[0] = 2;
  gcode[1] = 2;

  cpgsci(1);

  grid1[0] = 0.0;
  grid2[0] = 0.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, 0, 1212, c0, gcode, 0.0, 0, grid1, 0,
    grid2, 0, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
    &ic, cache, &ierr);
d1125 2
a1126 2
  /* Draw the frame. */
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d1128 1
a1128 1
  cpgpage();
d1131 116
a1246 116
  * Linear-linear plot with two types of alternative labelling.
  *   - PGSBOX uses subroutine PGCRFN.
  *   - Separable (i.e. orthogonal), linear coordinate system.
  *   - Use of function PGCRFN for separable axis types.
  *   - Alternative labelling and axis annotation.
  *   - Direct manipulation of the axis-crossing table.
  *   - Tick mark and grid line control.
  *   - User selection of what edges to label.
  *   - Automatic choice of coordinate increments.
  *------------------------------------------------------------------------*/

  printf("\nLinear plot with alternative labelling\n");

  if (large) {
    cpgvstd();
  } else {
    cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
  }
  cpgwnad(0.0f, 1.0f, 0.0f, 1.0f);

  naxis[0] = 512;
  naxis[1] = 512;

  blc[0] = 0.5;
  blc[1] = 0.5;
  trc[0] = naxis[0] + 0.5;
  trc[1] = naxis[1] + 0.5;

  /* Function types. */
  strcpy(fcode[0], "Lin ");
  strcpy(fcode[1], "Lin ");

  /* Reference pixel coordinates. */
  nldprm[0] = 0.5;
  nldprm[1] = 0.5;

  /* Coordinate increments. */
  nldprm[2] = 0.03;
  nldprm[3] = 0.03;

  /* Reference pixel values. */
  nldprm[4] = 20.0;
  nldprm[5] =  0.0;

  /* Annotation. */
  strcpy(idents[0], "temperature of frog (\\uo\\dC)");
  strcpy(idents[1], "distance hopped (m)");
  strcpy(idents[2], "");

  opt[0] = ' ';
  opt[1] = ' ';

  /* Reduced size lettering. */
  cpgsch(0.8f*scl);

  /* Draw tick marks at the bottom for the first coordinate, grid lines  */
  /* for the second.  Setting GCODE[0] = -1 inhibits information being   */
  /* stored for labels on the top edge while GCODE[1] = 2 causes         */
  /* information to be stored for labels on the right edge even if those */
  /* labels are not actually produced.                                   */
  cpgsci(1);
  gcode[0] = -1;
  gcode[1] =  2;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  /* Set LABCTL = 21 to label the bottom and left edges only. */
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 21, 0, c0, gcode, 2.0, 0, grid1, 0, grid2,
    0, pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache, &ierr);

  /* Information for labels on the right edge was stored in the crossing   */
  /* table on the first call to PGSBOX.  We now want to manipulate it to   */
  /* convert metres to feet.  Note that while it's a simple matter to draw */
  /* alternative sets of tick marks on opposite edges of the frame, as     */
  /* with the two temperature scales, we have the slightly more difficult  */
  /* requirement of labelling grid lines with different values at each     */
  /* end.                                                                  */
  for (j = 0; j <= ic; j++) {
    /* Look for entries associated with the right edge of the frame. */
    if (cache[j][0] == 4.0) {
      /* Convert to feet, rounding to the nearest 0.1. */
      cache[j][3] *= 1e3/(25.4*12.0);
      cache[j][3] = floor(cache[j][3]*10.0 + 0.5)/10.0;
    }
  }

  /* Annotation for the right edge. */
  strcpy(idents[0], "");
  strcpy(idents[1], "(feet)");

  /* Set LABCTL = 12000 to label the right edge with the second coordinate */
  /* without redrawing the grid lines. */
  cpgsbox(blc, trc, idents, opt, 12000, 0, c0, gcode, 2.0, 0, grid1, 0,
    grid2, 0, pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache,
    &ierr);

  /* The alternative temperature scale in Fahrenheit is to be constructed */
  /* with a new set of tick marks. */
  nldprm[2] = nldprm[2]*1.8;
  nldprm[4] = nldprm[4]*1.8 + 32.0;

  /* Draw tick marks at the top for the first coordinate, don't redo grid */
  /* lines for the second. */
  gcode[0] = -100;
  gcode[1] = 0;

  /* Annotation for the top edge. */
  strcpy(idents[0], "(\\uo\\dF)");
  strcpy(idents[1], "");

  /* Set LABCTL = 100 to label the top edge; Set IC = -1 to redetermine */
  /* the coordinate extrema. */
  ic = -1;
  cpgsbox(blc, trc, idents, opt, 100, 0, c0, gcode, 2.0, 0, grid1, 0, grid2,
    0, pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache, &ierr);
d1248 2
a1249 2
  /* Draw the frame. */
  cpgbox("bc", 0.0f, 0, "bc", 0.0f, 0);
d1251 1
a1251 1
  cpgpage();
d1254 35
a1288 35
  * Calendar axes using subroutine PGLBOX.
  *   - Separable (i.e. orthogonal), linear coordinate system.
  *   - Use of PGLBOX for simple linear axis types.
  *   - Automatic choice of what edges to label; results in labelling the
  *     bottom and left sides of the plot.
  *   - Automatic choice of coordinate increments.
  *   - Calendar date axis labelling.
  *   - Single-character annotation on a vertical axis is upright.
  *------------------------------------------------------------------------*/

  printf("\nCalendar axes using subroutine PGLBOX\n");

  cpgswin(51900.0f, 52412.0f, 51900.0f, 57020.0f);

  /* Annotation. */
  strcpy(idents[0], "Date started");
  strcpy(idents[1], "Date finished");
  strcpy(idents[2], "Calendar axes using subroutine PGLBOX");

  opt[0] = 'Y';
  opt[1] = 'Y';

  /* Reduced size lettering. */
  cpgsch(0.7f*scl);

  /* Draw tick marks on each axis. */
  cpgsci(1);
  gcode[0] = 1;
  gcode[1] = 1;
  grid1[0] = 0.0;
  grid2[0] = 0.0;

  ic = -1;
  cpglbox(idents, opt, 0, 0, c0, gcode, 2.0, 0, grid1, 0, grid2, 0, 256, &ic,
    cache, &ierr);
d1290 2
a1291 2
  /* Draw the frame. */
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d1293 1
a1293 1
  cpgpage();
d1296 59
a1354 59
  * Simple linear axes handled by PGWCSL.
  *   - Separable (i.e. orthogonal), linear coordinate system.
  *   - Automatic choice of what edges to label; results in labelling the
  *     bottom and left sides of the plot.
  *   - Automatic choice of coordinate increments.
  *   - Tick marks and labels at the edges of the frame.
  *   - Single-character annotation on a vertical axis is upright.
  *------------------------------------------------------------------------*/

  printf("\nSimple linear axes handled by pgwcsl()\n");

  naxis[0] = 3;
  naxis[1] = 3;

  blc[0] = 0.5;
  blc[1] = 0.5;
  trc[0] = naxis[0] + 0.5;
  trc[1] = naxis[1] + 0.5;

  status = wcsini(1, 2, &wcs);

  strcpy(wcs.ctype[0], "x");
  strcpy(wcs.ctype[1], "y");

  /* Reference pixel coordinates. */
  wcs.crpix[0] = 2.0;
  wcs.crpix[1] = 2.0;

  /* Coordinate increments. */
  wcs.cdelt[0] = 1.0;
  wcs.cdelt[1] = 1.0;

  /* Spherical coordinate references. */
  wcs.crval[0] = 2.0;
  wcs.crval[1] = 2.0;

  /* Annotation. */
  strcpy(idents[0], "X");
  strcpy(idents[1], "Y");
  strcpy(idents[2], "Simple linear axes handled by pgwcsl()");

  opt[0] = ' ';
  opt[1] = ' ';

  /* Reduced size lettering. */
  cpgsch(0.8f*scl);

  /* Draw full grid lines. */
  cpgsci(1);
  gcode[0] = 1;
  gcode[1] = 1;

  grid1[0] = 0.0;
  grid2[0] = 0.0;

  ic = -1;
  cpgsbox(blc, trc, idents, opt, 0, 0, c0, gcode, 2.0, 0, grid1, 0, grid2,
    0, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256, &ic,
    cache, &ierr);
d1356 2
a1357 2
  /* Draw the frame. */
  cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);
d1359 1
a1359 1
  cpgpage();
d1363 1
a1363 1
  wcsfree(&wcs);
d1365 2
a1366 2
  cpgask(0);
  cpgend();
d1368 1
a1368 1
  return 0;
@


4.2
log
@PGSBOX 4.2
@
text
@d2 30
a31 29
*
*   PGSBOX 4.2 - a non-linear coordinate axis plotter for PGPLOT.
*   Copyright (C) 1997-2005, Mark Calabretta
*
*   PGSBOX is free software; you can redistribute it and/or modify it under
*   the terms of the GNU General Public License as published by the Free
*   Software Foundation; either version 2 of the License, or (at your option)
*   any later version.
*
*   PGSBOX is distributed in the hope that it will be useful, but WITHOUT ANY
*   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
*   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
*   details.
*
*   You should have received a copy of the GNU General Public License along
*   with PGSBOX; if not, write to the Free Software Foundation, Inc.,
*   59 Temple Place, Suite 330, Boston, MA  02111-1307, USA
*
*   Correspondence concerning WCSLIB may be directed to:
*      Internet email: mcalabre@@atnf.csiro.au
*      Postal address: Dr. Mark Calabretta
*                      Australia Telescope National Facility, CSIRO
*                      PO Box 76
*                      Epping NSW 1710
*                      AUSTRALIA
*
*   Author: Mark Calabretta, Australia Telescope National Facility
*   http://www.atnf.csiro.au/~mcalabre/index.html
*   $Id: cpgtest.c,v 4.1 2005/08/26 12:54:06 cal103 Exp cal103 $
d47 7
a67 7
   /* Uncomment the following two lines to raise SIGFPE on floating point
    * exceptions for the Sun FORTRAN compiler.  This signal can be caught
    * within 'dbx' by issuing the command "catch FPE".
    */
/* #include <floatingpoint.h> */
/* ieee_handler("set", "common", SIGFPE_ABORT); */

d970 161
@


4.2.1.1
log
@PGSBOX 4.2 development branch.
@
text
@d3 1
a3 1
*   PGSBOX 4.3 - a non-linear coordinate axis plotter for PGPLOT.
d30 1
a30 1
*   $Id: cpgtest.c,v 4.2 2005/09/21 13:27:15 cal103 Exp cal103 $
@


4.2.1.2
log
@Added two new tests, oblique CYP and TAN graticules arising from checking
example headers in William Thompson's solar coordinates paper.
@
text
@d30 1
a30 1
*   $Id: cpgtest.c,v 4.2.1.1 2005/12/05 03:23:34 cal103 Exp cal103 $
a960 161
      &ic, cache, &ierr);

   /* Draw the frame. */
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

   cpgpage();

  /*--------------------------------------------------------------------------
   * Cylindrical perspective projection.
   *    - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
   *    - BLC, TRC unrelated to pixel coordinates.
   *    - Demonstrate parameter definition for PGWCSL.
   *    - Reduced size lettering.
   *    - Manual and automatic choice of coordinate increments.
   *    - Suppression of common zero minute and second fields in
   *      sexagesimal time format.
   *------------------------------------------------------------------------*/

   printf("\nCylindrical perspective projection\n");

   blc[0] = -180.0;
   blc[1] =  -90.0;
   trc[0] =  180.0;
   trc[1] =  +90.0;

   /*  Reset viewport for rectangular image. */
   if (large) {
      cpgvstd();
   } else {
      cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
   }
   cpgwnad (blc[0], trc[0], blc[1], trc[1]);

   status = wcsini(1, 2, &wcs);

   /* Set projection type to cylindrical perspective. */
   strcpy(wcs.ctype[0], "RA---CYP");
   strcpy(wcs.ctype[1], "DEC--CYP");

   /* Reference pixel coordinates. */
   wcs.crpix[0] = 0.0;
   wcs.crpix[1] = 0.0;

   /* Coordinate increments. */
   wcs.cdelt[0] = -1.0;
   wcs.cdelt[1] =  1.0;

   /* Set parameters to draw the native grid. */
   wcs.crval[0] =  45.0;
   wcs.crval[1] = -90.0;
   wcs.lonpole  = 999.0;

   /* mu and lambda projection parameters. */
   wcs.npv = 2;
   wcs.pv[0].i = 2;
   wcs.pv[0].m = 1;
   wcs.pv[0].value = 0.0;
   wcs.pv[1].i = 2;
   wcs.pv[1].m = 2;
   wcs.pv[1].value = 1.0;

   /* Annotation. */
   strcpy(idents[0], "Right ascension");
   strcpy(idents[1], "Declination");
   strcpy(idents[2], "WCS cylindrical perspective projection");

   opt[0] = 'G';
   opt[1] = 'E';

   /* Reduced size lettering. */
   cpgsch(0.7f*scl);

   /* Draw full grid lines. */
   gcode[0] = 2;
   gcode[1] = 2;

   cpgsci(1);

   grid1[0] = 0.0;
   grid2[0] = 0.0;

   ic = -1;
   cpgsbox(blc, trc, idents, opt, 2121, 1212, c0, gcode, 0.0, 0, grid1, 0,
      grid2, 1, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
      &ic, cache, &ierr);

   /* Draw the frame. */
   cpgbox("BC", 0.0f, 0, "BC", 0.0f, 0);

   cpgpage();

  /*--------------------------------------------------------------------------
   * Gnomonic projection.
   *    - PGSBOX uses subroutine PGWCSL to interface to WCSLIB.
   *    - Demonstrate parameter definition for PGWCSL.
   *    - Reduced size lettering.
   *    - Manual and automatic choice of coordinate increments.
   *    - Suppression of common zero minute and second fields in
   *      sexagesimal time format.
   *------------------------------------------------------------------------*/

   printf("\nTAN projection\n");

   naxis[0] = 100;
   naxis[1] = 100;

   blc[0] = 0.5;
   blc[1] = 0.5;
   trc[0] = naxis[0] + 0.5;
   trc[1] = naxis[1] + 0.5;

   /*  Reset viewport for rectangular image. */
   if (large) {
      cpgvstd();
   } else {
      cpgvsiz(1.0f, 3.0f, 1.0f, 3.0f);
   }
   cpgwnad(0.0f, 1.0f, 0.0f, ((float)naxis[1])/((float)naxis[0]));

   status = wcsini(1, 2, &wcs);

   /* Set projection type to gnomonic. */
   strcpy(wcs.ctype[0], "RA---TAN");
   strcpy(wcs.ctype[1], "DEC--TAN");

   /* Reference pixel coordinates. */
   wcs.crpix[0] = 50.5;
   wcs.crpix[1] =  1.0;

   /* Coordinate increments. */
   wcs.cdelt[0] = 1e-3;
   wcs.cdelt[1] = 1e-3;

   /* Set parameters to draw the native grid. */
   wcs.crval[0] =  45.0;
   wcs.crval[1] = -89.7;
   wcs.lonpole  = 999.0;

   /* Annotation. */
   strcpy(idents[0], "Right ascension");
   strcpy(idents[1], "Declination");
   strcpy(idents[2], "WCS TAN projection");

   opt[0] = 'E';
   opt[1] = 'E';

   /* Reduced size lettering. */
   cpgsch(0.7f*scl);

   /* Draw full grid lines. */
   gcode[0] = 2;
   gcode[1] = 2;

   cpgsci(1);

   grid1[0] = 0.0;
   grid2[0] = 0.0;

   ic = -1;
   cpgsbox(blc, trc, idents, opt, 0, 1212, c0, gcode, 0.0, 0, grid1, 0,
      grid2, 0, pgwcsl_, 1, WCSLEN, 1, nlcprm, (int *)(&wcs), nldprm, 256,
@


4.2.1.3
log
@Removed comment re catching floating point exceptions in SunOS.
@
text
@d30 1
a30 1
*   $Id: cpgtest.c,v 4.2.1.2 2005/12/05 03:45:06 cal103 Exp cal103 $
d59 7
@


4.2.1.4
log
@Switched to LGPL 3.0.
@
text
@d2 29
a30 30

    PGSBOX 4.3 - an implementation of the FITS WCS standard.
    Copyright (C) 1997-2007, Mark Calabretta

    This file is part of PGSBOX.

    PGSBOX is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License as published by the
    Free Software Foundation, either version 3 of the License, or (at your
    option) any later version.

    PGSBOX is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
    more details.

    You should have received a copy of the GNU Lesser General Public License
    along with PGSBOX.  If not, see <http://www.gnu.org/licenses/>.

    Correspondence concerning PGSBOX may be directed to:
       Internet email: mcalabre@@atnf.csiro.au
       Postal address: Dr. Mark Calabretta
                       Australia Telescope National Facility, CSIRO
                       PO Box 76
                       Epping NSW 1710
                       AUSTRALIA

    Author: Mark Calabretta, Australia Telescope National Facility
    http://www.atnf.csiro.au/~mcalabre/index.html
    $Id: cpgtest.c,v 4.2.1.3 2005/12/16 03:42:59 cal103 Exp cal103 $
@


4.2.1.5
log
@Do Fortran name mangling using the F77_FUNC(name, NAME) macro defined in
wcsconfig_f77.h by 'configure'.
@
text
@d31 1
a31 1
    $Id: cpgtest.c,v 4.2.1.4 2007/12/03 05:41:29 cal103 Exp cal103 $
a46 7
/* Fortran name mangling. */
#include <wcsconfig_f77.h>
#define lngvel_ F77_FUNC(lngvel, LNGVEL)
#define fscan_  F77_FUNC(fscan,  FSCAN)
#define pgcrfn_ F77_FUNC(pgcrfn, PGCRFN)
#define pgwcsl_ F77_FUNC(pgwcsl, PGWCSL)

@


4.1
log
@PGSBOX 4.1: in the COE example, LATPOLE must be reset when drawing the
second (native) grid because it will have been set to a non-default value
by wcsset() when the first grid was drawn; set wcs.flag to -1 before
wcsinit() and call wcsfree() at the end; also cylfix.h -> wcsfix.h.
@
text
@d3 1
a3 1
*   PGSBOX 4.1 - a non-linear coordinate axis plotter for PGPLOT.
d30 1
a30 1
*   $Id: cpgtest.c,v 4.0 2005/02/04 12:19:45 cal103 Exp cal103 $
@


4.0
log
@PGSBOX 4.0: changed from LGPL to GPL.
@
text
@d3 1
a3 1
*   PGSBOX 4.0 - a non-linear coordinate axis plotter for PGPLOT.
d30 1
a30 1
*   $Id: cpgtest.c,v 3.6 2004/08/24 08:34:02 cal103 Exp cal103 $
a42 1
#include <cylfix.h>
d44 1
d342 1
d502 1
d1200 2
@


3.6
log
@PGSBOX 3.6
@
text
@d3 2
a4 2
*   PGSBOX 3.6 - a non-linear coordinate axis plotter for PGPLOT.
*   Copyright (C) 1997-2004, Mark Calabretta
d6 4
a9 4
*   This program is free software; you can redistribute it and/or modify it
*   under the terms of the GNU General Public License as published by the
*   Free Software Foundation; either version 2 of the License, or (at your
*   option) any later version.
d11 4
a14 4
*   This program is distributed in the hope that it will be useful, but
*   WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
*   General Public License for more details.
d17 2
a18 2
*   with this library; if not, write to the Free Software Foundation, Inc.,
*   675 Mass Ave, Cambridge, MA 02139, USA.
d30 1
a30 1
*   $Id: cpgtest.c,v 3.5 2004/06/28 05:28:22 mcalabre Exp mcalabre $
d199 1
a199 1
   * antenna which scans in azimuth with a receiver which scans simultaneously
d324 1
a324 1
   *    - Discovery of grid lines which do not cross any axis.
d333 1
a333 1
   *    - Suppression of labels which would overlap one another.
d407 1
a407 1
   *    - Discovery of grid lines which do not cross any axis.
d415 1
a415 1
   *    - Suppression of labels which would overlap one another.
d535 1
a535 1
   *    - User selection of which grid lines to plot.
d538 1
a538 1
   *    - Suppression of labels which would overlap one another.
d745 1
a745 1
   *    - Suppression of labels which would overlap one another.
@


3.5
log
@PGSBOX 3.5: print the name of each example as it is run; added titles to the
calendar axes and the pgwcsl_() linear axes plots.
@
text
@d3 1
a3 1
*   PGSBOX 3.5 - a non-linear coordinate axis plotter for PGPLOT.
d30 1
a30 1
*   $Id: cpgtest.c,v 3.4 2004/02/10 23:56:37 mcalabre Exp mcalabre $
@


3.4
log
@PGSBOX 3.4
@
text
@d3 1
a3 1
*   PGSBOX 3.4 - a non-linear coordinate axis plotter for PGPLOT.
d29 2
a30 1
*   $Id: cpgtest.c,v 3.3 2003/10/22 08:56:52 mcalabre Exp mcalabre $
d38 1
d143 2
d216 2
d274 2
d340 2
d420 2
d545 2
d748 2
d903 2
d978 2
d1100 2
d1107 1
a1107 1
   strcpy(idents[2], "");
d1132 1
a1132 2
   * Simple linear axes.
   *    - Simple linear axes handled by PGWCSL.
d1141 2
d1171 1
a1171 1
   strcpy(idents[2], "");
@


3.3
log
@PGSBOX 3.3: corrected all calls to cpgsch(); all calls to wcsini() now
explicitly request memory allocation; added two further examples - a plate
carree projection with the poles and +/- 180 deg meridians coincident with
the frame, and use of pgwcsl_() for a simple linear plot.
@
text
@d3 2
a4 2
*   PGSBOX 3.3 - a non-linear coordinate axis plotter for PGPLOT.
*   Copyright (C) 1997-2003, Mark Calabretta
d29 1
a29 1
*   $Id: cpgtest.c,v 3.2 2003/09/09 07:52:48 mcalabre Exp mcalabre $
@


3.2
log
@PGSBOX 3.2: set wcs.flag = -1 to initialize memory management in wcsini();
changed the ninth example to use cpglbox().
@
text
@d3 1
a3 1
*   PGSBOX 3.2 - a non-linear coordinate axis plotter for PGPLOT.
d29 1
a29 1
*   $Id: cpgtest.c,v 3.1 2003/04/28 05:02:51 mcalabre Exp mcalabre $
a33 1
*   $Id: cpgtest.c,v 3.1 2003/04/28 05:02:51 mcalabre Exp mcalabre $
d122 2
d125 3
a127 3
   * First example: longitude-velocity map.  The y-axis is regularly spaced in
   * frequency but is to be labelled as a true relativistic velocity.  PGSBOX
   * uses subroutine LNGVEL.  Features:
d194 4
a197 4
   * Second example: azimuth-frequency scan.  This sort of output might be
   * obtained from an antenna which scans in azimuth with a receiver which
   * scans simultaneously in frequency.  PGSBOX uses subroutine FSCAN.
   * Features:
d236 1
a236 1
   cpgsch(1.0*scl);
d257 2
a258 2
   * Third example: Z versus time plot.  PGSBOX uses subroutine PGCRFN.
   * Features:
d293 1
a293 1
   cpgsch(1.0*scl);
d307 1
a307 1
   cpgbox("BC", 0.0, 0, "BC", 0.0, 0);
d312 2
a313 2
   * Fourth example: A simple SIN projection near the south celestial pole.
   * PGSBOX uses subroutine PGWCSL to interface to WCSLIB.  Features:
a331 1
   wcs.flag = -1;
d369 1
a369 1
   cpgsch(0.8*scl);
d391 2
a392 2
   * Fifth example: Conic equal area.  PGSBOX uses subroutine PGWCSL
   * to interface to WCSLIB.  Features:
d410 1
a410 1
   status = wcsini(0, 2, &wcs);
d447 1
a447 1
   cpgsch(0.8*scl);
d510 2
a511 2
   * Sixth example: Polyconic with colour-coded grid.  PGSBOX uses subroutine
   * PGWCSL to interface to WCSLIB.  Features:
d533 1
a533 1
   status = wcsini(0, 2, &wcs);
d568 1
a568 1
   cpgsch(0.9*scl);
d718 2
a719 2
   * Seventh example: Plate Carree projection.  PGSBOX uses subroutine PGWCSL
   * to interface to WCSLIB.  Features:
d750 1
a750 1
   status = wcsini(0, 2, &wcs);
d792 1
a792 1
   cpgsch(0.8*scl);
d871 74
a944 1
   cpgbox("BC", 0.0, 0, "BC", 0.0, 0);
d949 2
a950 2
   * Eighth example: linear-linear plot with two types of alternative
   * labelling.  PGSBOX uses subroutine PGCRFN.  Features:
d999 2
a1000 2
   /* Normal size lettering. */
   cpgsch(1.0*scl);
d1065 1
a1065 1
   cpgbox("bc", 0.0, 0, "bc", 0.0, 0);
d1070 8
a1077 9
   *     Ninth example: Calendar axes using subroutine PGLBOX.
   *     Features:
   *        - Separable (i.e. orthogonal), linear coordinate system.
   *        - Use of PGLBOX for simple linear axis types.
   *        - Automatic choice of what edges to label; results in labelling
   *          the bottom and left sides of the plot.
   *        - Automatic choice of coordinate increments.
   *        - Calendar date axis labelling.
   *        - Single-character annotation on a vertical axis is upright.
d1091 1
a1091 1
   cpgsch(0.7*scl);
d1107 67
d1176 1
@


3.1
log
@PGSBOX 3.1
@
text
@d3 1
a3 1
*   PGSBOX - a non-linear coordinate axis plotter for PGPLOT.
d29 1
a29 1
*   $Id: pgtest.f,v 1.22 2002/11/06 00:40:53 mcalabre Exp mcalabre $
d34 1
a34 1
*   $Id$
d331 1
d997 1
a997 1
   *     Ninth example: Calendar axes.  PGSBOX uses subroutine PGCRFN.
d1000 1
a1000 1
   *        - Use of function PGCRFN for separable axis types.
d1008 1
a1008 7
   /* Function types. */
   strcpy(fcode[0], "Lin ");
   strcpy(fcode[1], "Lin ");

   /* Reference pixel coordinates. */
   nldprm[0] = 0.5;
   nldprm[1] = 0.5;
a1009 8
   /* Coordinate increments. */
   nldprm[2] =  0.5;
   nldprm[3] = 10.0;

   /* Reference pixel values. */
   nldprm[4] = 51900.0;
   nldprm[5] = 51900.0;

d1029 2
a1030 2
   cpgsbox(blc, trc, idents, opt, 0, 0, c0, gcode, 2.0, 0, grid1, 0, grid2, 0,
      pgcrfn_, 8, 2, 4, fcode[0], nliprm, nldprm, 256, &ic, cache, &ierr);
@
