| 1 |
/* |
| 2 |
* (C) Copyright 1996-2016 ECMWF. |
| 3 |
* |
| 4 |
* This software is licensed under the terms of the Apache Licence Version 2.0 |
| 5 |
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 6 |
* In applying this licence, ECMWF does not waive the privileges and immunities |
| 7 |
* granted to it by virtue of its status as an intergovernmental organisation nor |
| 8 |
* does it submit to any jurisdiction. |
| 9 |
*/ |
| 10 |
|
| 11 |
magics_height = 358.; |
| 12 |
magics_left = 60; |
| 13 |
magics_outside = function (x, y) { |
| 14 |
if (smaller(x, 60) ) |
| 15 |
return true; |
| 16 |
if (greater(x, 740) ) |
| 17 |
return true; |
| 18 |
if (smaller(y, 89.3861) ) |
| 19 |
return true; |
| 20 |
if (greater(y, 446.931) ) |
| 21 |
return true; |
| 22 |
return false; |
| 23 |
} |
| 24 |
; |
| 25 |
magics_reprojection = function (xd, yd) |
| 26 |
{ |
| 27 |
yd = 446.931 - yd; |
| 28 |
xpc = (xd - 60 ) * ( 9.14838e+06 / 680) + -4.91719e+06; |
| 29 |
ypc = yd * ( 4.81581e+06 / 357.545) + -6.52533e+06; |
| 30 |
px = xpc - 0; |
| 31 |
py = ypc - 0; |
| 32 |
ro = Math.sqrt(px*px + py*py); |
| 33 |
t = (ro* 1)/(1.18883e+07) ; |
| 34 |
xx = 1.5708 - 2.*Math.atan(t); |
| 35 |
yll = xx + 0*Math.sin(2*xx) + 0*Math.sin(4*xx) + 0*Math.sin(6*xx); |
| 36 |
if (py != 0.) |
| 37 |
xll = 0+ Math.atan(px/(-py)); |
| 38 |
if (and(greater(px, 0.), greater(py,0.))) |
| 39 |
xll = xll + 3.14159; |
| 40 |
else if (and(smaller(px,0.), greater(py,0.))) |
| 41 |
xll = xll - 3.14159; |
| 42 |
else if (and(greater(px, 0.), equal(py,0.))) |
| 43 |
xll = 0+ 3.14159/ 2.; |
| 44 |
else if (and(smaller(px, 0.), equal(py,0.))) |
| 45 |
xll = 0 - 3.14159/ 2.; |
| 46 |
else if (and(equal(px,0.), equal(py, 0.))) |
| 47 |
xll = 0; |
| 48 |
if (smaller(xll, (-3.14159) )) xll += 2.* 3.14159; |
| 49 |
else if (greater(xll, 3.14159) ) xll -= 2.*3.14159; |
| 50 |
xll = xll * 57.2958; |
| 51 |
yll = yll * 57.2958; |
| 52 |
|
| 53 |
return { lon : xll, lat : yll } ; |
| 54 |
} |
| 55 |
; |
| 56 |
magics_top = 122.; |
| 57 |
magics_version = "2.6.0"; |
| 58 |
magics_width = 680; |