function ZD=hardie_inv(AirMass)
% Convert hardie airmass to altitude
% Package: celestial.coo
% Description: Inverse Hardie airmass function. Convert airmass to zenith
%              distance.
% Input  : - Air Mass
% Output : - Zenith distance [radians].
% Tested : Matlab 5.3
%     By : Eran O. Ofek                    Sep 2001
%    URL : http://weizmann.ac.il/home/eofek/matlab/
% Example: ZD=celestial.coo.hardie_inv(2);
% Reliable: 2
%--------------------------------------------------------------------------

ZDA=[    0    1.0000
    0.0175    1.0002
    0.0349    1.0006
    0.0524    1.0014
    0.0698    1.0024
    0.0873    1.0038
    0.1047    1.0055
    0.1222    1.0075
    0.1396    1.0098
    0.1571    1.0124
    0.1745    1.0154
    0.1920    1.0187
    0.2094    1.0223
    0.2269    1.0263
    0.2443    1.0306
    0.2618    1.0352
    0.2793    1.0402
    0.2967    1.0456
    0.3142    1.0514
    0.3316    1.0575
    0.3491    1.0640
    0.3665    1.0710
    0.3840    1.0784
    0.4014    1.0862
    0.4189    1.0944
    0.4363    1.1032
    0.4538    1.1124
    0.4712    1.1221
    0.4887    1.1323
    0.5061    1.1430
    0.5236    1.1543
    0.5411    1.1662
    0.5585    1.1788
    0.5760    1.1919
    0.5934    1.2057
    0.6109    1.2202
    0.6283    1.2355
    0.6458    1.2515
    0.6632    1.2683
    0.6807    1.2860
    0.6981    1.3046
    0.7156    1.3241
    0.7330    1.3446
    0.7505    1.3662
    0.7679    1.3890
    0.7854    1.4129
    0.8029    1.4381
    0.8203    1.4647
    0.8378    1.4928
    0.8552    1.5224
    0.8727    1.5537
    0.8901    1.5868
    0.9076    1.6218
    0.9250    1.6589
    0.9425    1.6983
    0.9599    1.7402
    0.9774    1.7847
    0.9948    1.8321
    1.0123    1.8826
    1.0297    1.9367
    1.0472    1.9945
    1.0647    2.0565
    1.0821    2.1232
    1.0996    2.1949
    1.1170    2.2724
    1.1345    2.3563
    1.1519    2.4473
    1.1694    2.5464
    1.1868    2.6547
    1.2043    2.7733
    1.2217    2.9039
    1.2392    3.0483
    1.2566    3.2086
    1.2741    3.3876
    1.2915    3.5887
    1.3090    3.8159
    1.3265    4.0748
    1.3439    4.3720
    1.3614    4.7164
    1.3788    5.1198
    1.3963    5.5979
    1.4137    6.1723
    1.4312    6.8728
    1.4486    7.7408
    1.4661    8.8320
    1.4835   10.2106
    1.5010   11.8831
    1.5184   13.3330];

ZD = interp1(ZDA(:,2),ZDA(:,1),AirMass,'linear');
