This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hello Tony, Thanks for the interesting question! I suspect your suspicion is right regarding the Mercator projection. Calculating the longitudinal index via the slope/intercept formula works because the longitudinal data are uniformly spaced. Because the latitudinal values are Mercator spaced, you cannot use the same formula. Unfortunately, I am unable to tell you what formula you *should* use. You may need to find an alternate dataset which contains uniform projections, or create a new dataset in which you've applied an inverse-mercator projection to the latitudes contained within this file. I feel silly supplying you with a link to the Mercator page on Wikipedia, as I'm sure you have already looked at it; however, since I'm am going to refer you to it, I include the link for completion. * https://en.wikipedia.org/wiki/Mercator_projection I suspect the answer to your question may be found in the mathematics on this page, but again, perhaps the simpler answer would be to locate a different dataset which contains uniform latitude and longitudes. I'm sorry I can't provide a more directly useful answer, but hopefully this information will be of some use to you. Have a good day, -Ward > Hi, > > I downloaded smith_sandwell_topo_v8_2.nc from > https://www.unidata.ucar.edu/software/netcdf/examples/files.html, and am > trying to understand the data it contains. I've been able to read the > values, and have come up with a fairly complete map of the data within. > However, my calculations to determine the latitude are yielding > apparently incorrect values, with latitude increasingly wrong as I > approach the poles. This sounds like something to do with projetion > issues, but I'm not sure where my math is wrong? Can you help? > > As a sample data point, I'm using the southernmost point of Africa. > Google Maps reports this to be -34.837352,19.980005. The same point > within the smith_sandwell file appears to be at 591,2060. > > I've read the following values from the smith_sandwell file: > longitude = 10800 ; > latitude = 6336 ; > longitude:long_name = "Uniformly spaced longitudes (.01667E -> 359.9833E) > latitude:long_name = "Mercator spaced latitudes (72.0009S -> 72.0009N)" ; > > To calculate that point's longitude, I'm running the following calculation: > 591/10800 * (359.9833 - .01667) + .01667 = 19.714843919 > > This seems more or less correct. I'm using the same calculation to > determine latitude, and coming up with: > 2060/6336 * (72.0009 - -72.0009) + -72.0009 = -25.182132955 > > This is wrong - I assume I'm not accounting for the Mercator projection > somehow, but I'm not sure how. Can you tell me what I need to do to > calculate the correct latitude given the y axis origin, range and > point's y location? Thanks. > > Tony Howard > > > Hi, > > I downloaded smith_sandwell_topo_v8_2.nc from > https://www.unidata.ucar.edu/software/netcdf/examples/files.html, and am > trying to understand the data it contains. I've been able to read the > values, and have come up with a fairly complete map of the data within. > However, my calculations to determine the latitude are yielding > apparently incorrect values, with latitude increasingly wrong as I > approach the poles. This sounds like something to do with projetion > issues, but I'm not sure where my math is wrong? Can you help? > > As a sample data point, I'm using the southernmost point of Africa. > Google Maps reports this to be -34.837352,19.980005. The same point > within the smith_sandwell file appears to be at 591,2060. > > I've read the following values from the smith_sandwell file: > longitude = 10800 ; > latitude = 6336 ; > longitude:long_name = "Uniformly spaced longitudes (.01667E -> 359.9833E) > latitude:long_name = "Mercator spaced latitudes (72.0009S -> 72.0009N)" ; > > To calculate that point's longitude, I'm running the following calculation: > 591/10800 * (359.9833 - .01667) + .01667 = 19.714843919 > > This seems more or less correct. I'm using the same calculation to > determine latitude, and coming up with: > 2060/6336 * (72.0009 - -72.0009) + -72.0009 = -25.182132955 > > This is wrong - I assume I'm not accounting for the Mercator projection > somehow, but I'm not sure how. Can you tell me what I need to do to > calculate the correct latitude given the y axis origin, range and > point's y location? Thanks. > > Tony Howard > > > Hi, > > I downloaded smith_sandwell_topo_v8_2.nc from > https://www.unidata.ucar.edu/software/netcdf/examples/files.html, and am > trying to understand the data it contains. I've been able to read the > values, and have come up with a fairly complete map of the data within. > However, my calculations to determine the latitude are yielding > apparently incorrect values, with latitude increasingly wrong as I > approach the poles. This sounds like something to do with projetion > issues, but I'm not sure where my math is wrong? Can you help? > > As a sample data point, I'm using the southernmost point of Africa. > Google Maps reports this to be -34.837352,19.980005. The same point > within the smith_sandwell file appears to be at 591,2060. > > I've read the following values from the smith_sandwell file: > longitude = 10800 ; > latitude = 6336 ; > longitude:long_name = "Uniformly spaced longitudes (.01667E -> 359.9833E) > latitude:long_name = "Mercator spaced latitudes (72.0009S -> 72.0009N)" ; > > To calculate that point's longitude, I'm running the following calculation: > 591/10800 * (359.9833 - .01667) + .01667 = 19.714843919 > > This seems more or less correct. I'm using the same calculation to > determine latitude, and coming up with: > 2060/6336 * (72.0009 - -72.0009) + -72.0009 = -25.182132955 > > This is wrong - I assume I'm not accounting for the Mercator projection > somehow, but I'm not sure how. Can you tell me what I need to do to > calculate the correct latitude given the y axis origin, range and > point's y location? Thanks. > > Tony Howard > > Ticket Details =================== Ticket ID: SJY-200306 Department: Support netCDF Priority: Normal Status: Closed