# Metview Macro

# **************************** LICENSE START ***********************************
#
# Copyright 2012 ECMWF. This software is distributed under the terms
# of the Apache License version 2.0. In applying this license, ECMWF does not
# waive the privileges and immunities granted to it by virtue of its status as
# an Intergovernmental Organization or submit itself to any jurisdiction.
#
# ***************************** LICENSE END ************************************

function window(z)
	n=count(z)
	r=1
	c=1
	w=700
	h=700
	if n=2 then
		r=1
		c=2
		w=1500
		h=700
	else if n=3 then
		r=1
		c=3
		w=1500
		h=500
	else if n=4 then
		r=2
		c=2
		w=1000
		h=1000
	else if n=5 or n=6 then
		r=2
		c=3
		w=1500
		h=1000
	else if n=7 or n=8 then
		r=2
		c=4
		w=1500
		h=700
	else if n=9 then
		r=3
		c=3
		w=1000
		h=1000
	else if n>9 and n<13 then
		r=3
		c=4
		w=1500
		h=1000
	else if n>12 and n<17 then
		r=4
		c=4
		w=800
		h=1000
	else if n>16 and n<21 then
		r=4
		c=5
		w=1000
		h=1000
	else if n>20 and n<26 then
		r=5
		c=5
		w=750
		h=1000
	end if

	coastblack = pcoast(
			map_coastline_colour	:	"background",
			map_grid_line_style	:	"dot",
			map_grid_colour	:	"background",
			map_label	:	"off"
			)
	w=plotwindow(
			row	:	r,
			column	:	c,
			width	:	w,
			height	:	h,
			pane_organization	:	'connected',
			subpage_map_projection	:	"polar_stereographic",
			area	:	[24.42,-16.28,55.18,77.68],
			subpage_map_vertical_longitude	:	10.01,
			background	:	coastblack
			)
	return w
end window
