-
Notifications
You must be signed in to change notification settings - Fork 1
/
create_latlon_figfile.m
126 lines (82 loc) · 3.9 KB
/
create_latlon_figfile.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
%function create_latlon_figfile
%Creates .fig file for plotting of satellite or codar data
%bathyfile - a .mat file that is generated by John Kerfoot's reshape_topoXYZ.m
% file must be in /home/bosch/bathy/MatFiles/
%bathycontours - a vector array of bathymetric contour lines ie[-20 -40 -60]
%coastlinefile - a .mat file of lat/lon coastline locs
% file must be in /home/bosch/coastlines/
%outfilename - follows the naming convention of "region.resolution.fig"
%Examples:
display('Welcome to the RUCOOL create_latlon_figfile function! All bathymetry must be run through reshape_topoXYZ.m first. This function generates lat/lon figfiles (not mercator)');
%Setting the bathyfile
bathyfile = input('What bathymetric file would you like to use? Ex: nybight3sec_xy.mat :', 's');
bpath = input('Is this bathymetric file in the default path? /home/bosch/bathy/MatFiles/ (y,n) ', 's');
if strcmp(bpath, 'y') == 1
bathypath = '/home/bosch/bathy/MatFiles/';
else
bathypath = input('Please enter the bathymetric file path: ', 's');
end %if
%Setting the bathycontours
metersvsfeet = input('Would you like the bathymetry lines in meters or feet? :', 's');
bathycontours = input('What contour lines, in feet or meters, would you like plotted? Ex:[-10 -15 -25] :');
%Setting the coastline file
coastlinefile = input('What coastline file would you like to use? Ex: nybight_xy_coastline.mat :', 's');
cpath = input('Is this coastline file in the default path? /home/bosch/coastlines/ (y,n) ', 's');
if strcmp(cpath, 'y') == 1
coastlinepath = '/home/bosch/coastlines/';
else
coastlinepath = input('Please enter the coastline file path: ', 's');
end %if
%Lat/Lon limits of the region
latmin = input('latmin? Ex: 39.21 :');
latmax = input('latmax? Ex: 39.72 :');
lonmin = input('lonmin? Ex: -74.67 :');
lonmax = input('lonmax? Ex: -73.91 :');
%[lonxy latxy] = ll2merc([lonmin lonmax], [latmin latmax], 0)
lonxy = [lonmin lonmax];
latxy = [latmin latmax];
%loading bathyfile
display('Loading bathymetric file ...')
load([bathypath bathyfile]); %gives you DETHI, mercLONI, mercLATI
%load(['/home/kerfoot/mapping/regions/endurance_line/matFiles/' bathyfile]);
bad = find(DEPTHI == 99999);
DEPTHI(bad) = NaN;
%Converting bathy to feet
bathyunit = ' m'; %default units are meters
if strcmp(metersvsfeet, 'feet') == 1
DEPTHI = DEPTHI*3.2808399 ;
bathyunit = ' ft';
end
%loading coastlinefile
display('Loading coastline file ...')
load([coastlinepath coastlinefile]);
[coastlon coastlat] = merc2ll(coastline(:,1), coastline(:,2), 0);
display('Ok. Now it is time to plot your map ...')
%Plotting bathydata
%display('Plotting bathymetry ...')
[c, bathyplot] = contour(LONI, LATI, -DEPTHI, -bathycontours, 'k');
set(bathyplot(:), 'color', [0.75 0.75 0.75]);
%set(bathyplot(:), 'color', 'k');
set(gca, 'xlim', lonxy, 'ylim', latxy)
hold on
%plotting coastline
%display('Plotting coastline ...')
coast = plot(coastlon, coastlat, 'k');
set(bathyplot, 'linewidth', 0.75);
display('Please pick where you would like your bathymetric labels to be.');
bathylabel = clabel(c, bathyplot, 'manual');
for labloop=1:length(bathylabel)
set(bathylabel(labloop), 'String', [get(bathylabel(labloop), 'String') bathyunit])
set(bathylabel(labloop), 'FontSize', [9], 'FontWeight', 'Bold', 'color', [0.75 0.75 0.75])
%set(bathylabel(labloop), 'FontSize', [9], 'FontWeight', 'Bold', 'color', 'k')
end
save_file = input('Would you like to save this plot as a .fig file? (y,n)', 's');
if strcmp(save_file, 'y') == 1
%setting outfilename
outfilename = input('Please enter a filename for this figure: Ex.nybight.feet.lonlat.fig :', 's');
set(gcf, 'visible', 'off')
hgsave(outfilename)
display('Your .fig file has been saved!');
else
display('Ok. Your figure has not been saved.');
end %if