📄 mapug.html
字号:
in longitude/latitude, then <code>m_contour</code> or <code>m_contourf</code>can be used to plot that data. </p><ol> <h3> <a name="p8.1"> <li> <br> </li> </a> <a href="http://topex.ucsd.edu/marine_topo/text/topo.html">Sandwelland Smith Bathymetry </a> </h3> <p> A recent new bathymetry with approximately 1km resolution inlower latitude areas is being used by many people. This dataset isdescribedat <a href="http://topex.ucsd.edu/marine_topo">http://topex.ucsd.edu/marine_topo/ </a> and is available as a134Mb binary file at <a href="ftp://topex.ucsd.edu/pub/global_topo_2min">ftp://topex.ucsd.edu/pub/global_topo_2min/ </a> (get the filetopo_X.Y.img where X.Y is the version number). The authors haveincluded an m-file (<a href="ftp://topex.ucsd.edu/pub/global_topo_2min/matlab/mygrid_sand.m">mygrid_sand.m</a>)which can extract portions of the data (you will have to modiy pathnames within the code). Once this database (and the m-file) isinstalled onyour computer, you can use it in M_Map very easily. A typical usage isas follows: </p> <pre>% Extract data<br>[elevations,lat,lon]=mygrid_sand([lat_south lat_north long_west long_east]);<br><br>% Use in M_Map command<br>m_contour(lon,lat,elevations);<br></pre>For some projections, you must make sure that the 'lon' values returnedby <code>mygrid_sand.m</code> fall within the range used in thisprojection (i.e. you may have to add/subtract 360). This seems tohappen all the time for areas in the west (i.e. negative longitudes),if you forget this you often end up with bewildering error messagesabout empty vectors!</ol><hr><h2><a name="10._Using_TerrainBase_5-minute_global"></a> <a name="p9">10.Using TerrainBase 5-minute or ETOPO2 2-minute globalbathymetry/topography </a> </h2><ol><li> <p> For many purposes the elevation database accessed by M_Mapprovidesadequate resolution. However, there are also many cases when moredetailis desired. I have not included a higher-resolution database because itwould greatly increase the size of the package. However, v1.2 includesm-files to access and plot a popular global 5-minutebathymetry/topography database, after a few minutes of work. </p><p> This section provides instructions on how to download <a href="http://dss.ucar.edu/datasets/ds759.2/"> TerrainBase</a>, andconvert it from a 56Mb ASCII file to a 18Mb binary file using <code>m_tba2b.m</code>. It is then straightforward to access and plotbathymetry from this file using <code> m_tbase.m</code>, which is inevery way functionally identical to <code>m_elev</code> (see Section <a href="#p3.2">3.2</a>). </p><p> TerrainBase is also available on CDrom, and is also commonlystoredin netcdf (or other) binary format somewhere on many academic networks.If you modify <code> m_tbase.m </code> to access data from one ofthese sources, let me know! </p><p> How to install TerrainBase: </p><ol> <li> get and uncompress the tbase.Z file from <a href="http://dss.ucar.edu/datasets/ds759.2/">http://dss.ucar.edu/datasets/ds759.2/ </a> into the m_map directory. <p> </p> </li> <li> Run <code> m_tba2b('PATHNAME') </code> to store theresulting18Mb binary file as <code> PATHNAME/tbase.int</code>. <p> </p> </li> <li> Delete the original ASCII file <code>tbase</code>. <p> </p> </li> <li> Edit the <code>PATHNAME</code> setting in <code>m_tbase</code>to point to the location of this file. </li></ol>That's it! Test things out with this map of the western mediterranean:<pre>m_proj('lambert','lon',[-10 20],'lat',[33 48]);<br>m_tbase('contourf');<br>m_grid('linestyle','none','tickdir','out','linewidth',3);<br></pre><center> <img src="./extbase.gif"> </center><br></li><li> As of Apr 2006, there is a corrected higher-resolution (2 minute) database <a href="http://dss.ucar.edu/datasets/ds759.3/"> ETOPO2</a>. Download <a href="http://dss.ucar.edu/datasets/ds759.3/data/etopo2_2006apr/etopo2_2006apr.raw.gz"> http://dss.ucar.edu/datasets/ds759.3/data/etopo2_2006apr/etopo2_2006apr.raw.gz</a> (a gzipped binary), gunzip it into a 116Mb file, edit the <code>PATHNAME</code> setting in <code>m_etopo2</code>to point to the location of this file, and then use it in the same way as <code>m_tbase</code>and <code>m_elev</code>. UCAR requires users to register and the second link won't work without you doingthis (go to first link and follow instructions). </li></ol> <h2> <a name="p9.5">11. Using GSHHS high-resolution coastlinedatabase </a> </h2><p> </p><ol> <h3> <a name="p9.6"> <li> Installing GSHHS </li> </a></h3> <a name="p9.6"> </a> <p> When drawing maps there is always a tradeoff between theexecutiontime of the generating program and the resolution of the resulting map.Included in M_Map is a 1/4 degree coastline database which can be usedto generate very fast maps, with adequate resolution for many purposes. </p> <p> However, it is often desirable to be able to make detailed mapsoflimited geographic areas. For this purpose a higher-resolutioncoastlinedatabase is necessary. I have not included such a database in M_Mapbecauseit would greatly increase the size of the package. However, I haveincludedm-files to access and use a popular high-resolution database called <a href="http://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html"> GSHHS </a> </p> <p> As distributed, GSHHS consists of a hierarchical set ofdatabasesat different resolutions. The lowest or "crude" resolution is not asgoodas the M_Map database, although it contains many more inland lakes. The"high" resolution consists of points about 200m apart. There is also anevenfiner "full" resolution. You can install part or all of the database(depending on how much disk space you have available). The "full"resolution occupies 90Mb of disk space, and successively coarserresolutions are smaller by about 1/4. Thus "high" resolution occupies21Mb, "intermediate" uses 6Mb, and "low" uses 1.1Mb (one reason for notalways using "high" resolutionis that the entire 90Mb database must be read and processed each call,which may take some time). </p> <p> How to install GSHHS: </p> <ol> <li> Go to <a href="http://www.ngdc.noaa.gov/mgg/shorelines/data/gshhs/">http://www.ngdc.noaa.gov/mgg/shorelines/data/gshhs/</a>. </li> <li> Get and uncompress any or all of the files <code>gshhs_c.b.gz, gshhs_l.b.gz, gshhs_i.b.gz</code> and/or <code>gshhs_h.b.gz</code>in a convenient directory. One useful place is in <code>m_map/private</code>.GSHHS data format has changed between v1.2 and 1.3, but m_mapshould be able to figure this out.</li> <li> If the database files are not in subdirectory <code>m_map/private </code>, you must edit the <code>FILNAME</code>settings in <code>m_gshhs_c.m, m_gshhs_l.m, m_gshhs_i.m, m_gshhs_h.m</code>and/or <code>m_gshhs_f.m</code> to point to the appropriate files. </li> </ol> <h3> <a name="p9.7"> <li> Using GSHHS effectively </li> </a></h3> <a name="p9.7"> </a> The simplest calling mechanism is identicaltothat for <code> m_coast </code> (<a href="#p3"> Section 3 </a>). Forexample, to draw a gray-filled high-resolution coastline, <pre>m_gshhs_h('patch',[.5 .5 .5]);<br></pre>is sufficient. However, execution times may be very, very long, as theentire database must be searched and processed. I would not recommendtrying to draw world maps with the intermediate or high-resolutioncoastlines! There are two ways to speed this up. The first is merely touse a lower-resolution database, with fewer points. The second isuseful if you are going tobe repeatedly drawing a map (because, for example, it's the base figurefor your work). In this case I recommend that you save an intermediateprocessed (generally smaller) file as follows: <pre>m_proj ... % set up projection parameters<br><br>% This command does not draw anything - it merely processes the <br>% high-resolution database using the current projection parameters <br>% to generate a smaller coastline file called "gumby"<br><br>m_gshhs_h('save','gumby');<br><br>% Now we can draw a few maps of the same area much more quickly<br><br>figure(1);<br>m_usercoast('gumby','patch','r');<br>m_grid;<br><br>figure(2);<br>m_usercoast('gumby','linewidth',2,'color','b');<br>m_grid('tickdir','out','yaxisloc','left');<br><br>etc.<br></pre></ol><hr><h2> <a name="p10">12. M_Map toolbox contents and description </a> </h2><p> </p><ol> <li> Contents.m - toolbox contents </li> <li> m_demo.m - demonstrates a few maps. </li></ol>User-callable functions<ol> <li> m_proj.m - initializes projection</li> <li>m_coord - geomagnstic to geographic coords<br clear="all"> <br> </li> <li>m_grid.m - draws grids </li> <li> m_scale.m - forces map to a given scale <p> </p> </li> <li> m_ungrid.m - erases map elements (if you want to changeparameters) <p> </p> </li> <li> m_coast.m - draws a coastline </li> <li> m_elev.m - draws elevation data </li> <li> m_tbase.m - draws elevation data from high-resolution database </li> <li> m_etopo2.m - draws elevation data from (another) high-resolution database </li> <li> m_gshhs_c.m - draws coastline from GSHHS crude database </li> <li> m_gshhs_l.m - draws coastline from GSHHS low-resolutiondatabase </li> <li> m_gshhs_i.m - draws coastline from GSHHSintermediate-resolutiondatabase </li> <li> m_gshhs_h.m - draws coastline from GSHHS high-resolutiondatabase </li> <li> m_gshhs_f.m - draws coastline from GSHHS full resolutiondatabase </li> <li> m_plotbndry.m - draws a political boundary from the DCW </li> <li> m_usercoast.m - draws a coastline using a user-specifiedsubset database. <p> </p> </li> <li> m_plot.m - draws line data in map coords </li> <li> m_line.m - draws line data in map coords </li> <li> m_text.m - adds text data in map coords </li> <li> m_legend.m - Draw a legend box </li> <li> m_patch.m - adds patch data in map coords</li> <li>m_pcolor - draws pcolor surface<br> </li> <li> m_quiver - draws arrows for vector data </li> <li> m_contour - draws contour lines for gridded data </li> <li> m_contourf - draws filled contours </li> <li> m_track - draws annotated tracklines </li> <li> m_range_ring - draws range rings <p> </p> </li> <li> m_ll2xy.m - converts from long/lat to map coordinates </li> <li> m_xy2ll.m - converts from map coordinates to long/lat</li> <li>m_geo2mag - converts from magnetic to geographic coords</li> <li>m_mag2geo - the reverse<br clear="all"> <br> </li> <li> m_lldist - distance between long/lat points </li> <li> m_xydist - distance between map coordinate points</li> <br> <li> m_fdist - location of point at given range/bearing alongellipsoidal earth </li> <li> m_idist - range/bearings between points on ellipsoidal earth </li> <li> m_geodesic - points on geodesics between given points onellipsoidal earth <br> </li> <li> m_tba2b.m - used in installing high-resolution elevationdatabase. <p> </p> </li> <li> m_vec.m - fancy arrows </li></ol>Internal functions (not meant to be user-callable)<ol> <li> private/mp_azim.m - azimuthal projections </li> <li> private/mp_cyl.m - cylindrical projections (equatorial) </li> <li> private/mp_conic.m - conic projections </li> <li> private/mp_tmerc.m - transverse cylindrical projections </li> <li> private/mp_utm.m - elliptical universal transverse cylindricalprojections </li> <li> private/mp_omerc.m - oblique cylindrical projection <p> </p> </li> <li> private/mu_util.m - various utility routines </li> <li> private/mu_coast.m - routines to handle coastlines.</li> <li>private/mc_coords - coordinate conversion.<br> </li> <li> private/clabel.m - patched version of clabel (matlab v5.1version
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -