Greetings everyone,
I'm interested in finding local maxima in a grid and haven't had any luck finding any material for doing so. The data below are coordinates (lat & lon) with density in a Census block.
Does anyone have any thoughts?
I'm interested in finding local maxima in a grid and haven't had any luck finding any material for doing so. The data below are coordinates (lat & lon) with density in a Census block.
Does anyone have any thoughts?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str15 block_group double(latitude longitude ln_density) "060590011011007" 33.9434681 -117.9524872 5.135222991690706 "060590011011009" 33.9426257 -117.9573157 6.835520232230146 "060590011011012" 33.9427533 -117.9551851 6.644436884918015 "060590011011013" 33.9427081 -117.9524832 4.46011340032976 "060590011011015" 33.9406193 -117.9513001 5.539835668679419 "060590011011016" 33.9401233 -117.9542428 8.459236258852162 "060590011011018" 33.939388 -117.9514234 8.597155114813228 "060590011012000" 33.9450803 -117.9732471 7.3089891868144825 "060590011012002" 33.9448772 -117.9742605 5.09649187215927 "060590011012006" 33.9426837 -117.9753973 5.955720608938407 "060590011012013" 33.9409248 -117.9721216 7.383450886265405 "060590011012015" 33.940325 -117.9760798 8.123953391754107 "060590011012017" 33.9401223 -117.9741911 9.670100630497895 "060590011012018" 33.9402502 -117.9714704 8.1007164966442 "060590011013003" 33.941427 -117.9614521 7.25995106610566 "060590011013007" 33.9425663 -117.9596719 7.169349890741607 "060590011013012" 33.9426864 -117.9642606 5.356662406785988 "060590011013020" 33.9398029 -117.9581037 8.589252557171747 "060590011014003" 33.9426845 -117.9684398 8.056539647149982 "060590011014005" 33.9436205 -117.9692948 6.110992034986769 "060590011014007" 33.9453006 -117.9693048 4.814600863501736 "060590011014008" 33.9458537 -117.9693632 6.146873104264652 "060590011014009" 33.9426228 -117.9698516 7.631225513518022 "060590011014011" 33.9423275 -117.966866 5.074397732463981 "060590011014014" 33.9414966 -117.9668138 5.460786693511332 "060590011014016" 33.940304 -117.9672266 7.539767479188758 "060590011021000" 33.9387185 -117.9688583 8.63816530727287 "060590011021001" 33.9393499 -117.9703444 7.285984209179809 "060590011021003" 33.9380985 -117.9723207 7.506867562045194 "060590011021004" 33.9393618 -117.9745767 7.472786954395636 "060590011021007" 33.9373803 -117.9755463 4.257395453610045 "060590011021009" 33.9370577 -117.9737302 5.834115676093456 "060590011021010" 33.9378978 -117.9712357 5.874003424949078 "060590011021013" 33.9370571 -117.9685726 5.554825879045601 "060590011022000" 33.9340999 -117.9701465 8.331081875194275 "060590011022002" 33.9342231 -117.9729718 4.681813582754534 "060590011022003" 33.9338535 -117.9736338 5.801669989040742 "060590011022007" 33.9337663 -117.9749678 6.4313901692496716 "060590011022009" 33.9324707 -117.9755643 7.861638731490633 "060590011023000" 33.9309823 -117.9688854 8.38465912113754 "060590011023001" 33.9291068 -117.9700995 4.273490140523255 "060590011023002" 33.9299584 -117.9745086 4.991112424458013 "060590011023008" 33.9302173 -117.9702333 6.234360214754072 "060590011031000" 33.9362313 -117.965508 6.50199921457729 "060590011031001" 33.9373815 -117.9665195 6.620841525611885 "060590011031002" 33.9382346 -117.967978 11.471327387680127 "060590011031004" 33.9346013 -117.9654764 5.19282912640733 "060590011031009" 33.9329882 -117.9651555 7.134669358036097 "060590011032001" 33.9311245 -117.9625063 4.054770754606315 "060590011032002" 33.9311803 -117.9660608 9.42103400132476 "060590011032003" 33.9304381 -117.9674894 8.021045940303441 "060590011032006" 33.9296139 -117.9678922 7.991798162748065 "060590011032008" 33.9288215 -117.9646909 6.015267914607325 "060590011032009" 33.9299527 -117.9654219 5.77137941583595 "060590011032011" 33.9297226 -117.9625118 5.6620955124275945 "060590011032013" 33.9287436 -117.9599904 4.9628342726815475 "060590011033000" 33.9379315 -117.9524642 8.11991161429057 "060590011033001" 33.9372933 -117.9570186 7.849143099579075 "060590011033002" 33.9363958 -117.9612607 8.027999492600122 "060590011033006" 33.9337007 -117.9615667 4.964860765149345 "060590011033009" 33.9357101 -117.9518561 6.520075202445931 "060590011033011" 33.9368418 -117.9537605 4.853627365295327 "060590012011001" 33.9352616 -117.9518526 6.556632101317803 "060590012011002" 33.9347752 -117.9545154 5.050518458674039 "060590012011006" 33.9347477 -117.958745 5.280860202210691 "060590012011008" 33.9329328 -117.9578704 5.595980596909468 "060590012011009" 33.9329391 -117.9561469 5.599226986636189 "060590012011010" 33.9341154 -117.9529452 5.669740651863973 "060590012011012" 33.9341211 -117.950758 6.930794493139333 "060590012012002" 33.9362321 -117.9492566 9.710435575231852 "060590012012003" 33.9343049 -117.9490173 4.633544295536558 "060590012012006" 33.9345805 -117.946952 9.553621300147421 "060590012012007" 33.9334458 -117.9469403 4.726439682843243 "060590012012008" 33.9325262 -117.9469341 5.797876853566051 "060590012012009" 33.9325251 -117.9485273 6.552428420302155 "060590012012010" 33.932525 -117.9498894 6.141296045642563 "060590012012011" 33.9325298 -117.9512748 6.543805354205198 "060590012012012" 33.9332114 -117.952458 6.181789186215849 "060590012012013" 33.933189 -117.9543664 5.715467975147872 "060590012012017" 33.9320774 -117.9512722 8.692765256421541 "060590012012018" 33.9320731 -117.9498865 9.084529755345171 "060590012012019" 33.9320735 -117.9485243 9.006257035788826 "060590012012020" 33.932075 -117.9469334 5.879235434681153 "060590012012021" 33.9320803 -117.9532577 7.184595500830879 "060590012013000" 33.9313696 -117.9518166 10.727702848354465 "060590012013001" 33.9297379 -117.9529581 6.7204211069319655 "060590012013003" 33.9300257 -117.9570014 7.41120985499027 "060590012021003" 33.9365482 -117.9404778 6.018700623742401 "060590012021005" 33.9347842 -117.9412616 5.194892775623838 "060590012021006" 33.9341549 -117.9396232 5.137143622641845 "060590012021010" 33.9323286 -117.9396011 7.593110153074182 "060590012021012" 33.9320768 -117.9412231 9.291328513848486 "060590012021013" 33.9321061 -117.9379581 9.54969547499974 "060590012022000" 33.9383831 -117.9429746 8.268228760057069 "060590012022001" 33.9363436 -117.94288 3.7913741652705797 "060590012022002" 33.9372469 -117.9450698 4.975614354389193 "060590012022004" 33.9354895 -117.9450397 6.798548003088426 "060590012022005" 33.9345663 -117.945075 6.423324949079913 "060590012022007" 33.9334671 -117.9428714 4.479673596339496 "060590012022008" 33.9334352 -117.9450208 5.166607784362848 end