7

I have a global raster file with 3600x1800 pixels. I don't have any information about the projection used.

The raster contains one band with a quantity with the unit "per square meter". How can I convert this to be "per square degree", prefereably using GDAL or QGis?

5
  • 2
    Unfortuantely without the base projection we can't calculate the 'per square degree' as the value will vary by large amounts depending on origin of the raster and subsequently the projection.
    – om_henners
    Commented Jun 25, 2012 at 6:53
  • okay, i'll try to get that info. but I suppose when using GDAL or any other library, the source projection is a parameter I can chose and doesn't really affect the algorithm / steps to use. or am I wrong?
    – andreash
    Commented Jun 25, 2012 at 12:34
  • @om A "global" raster will have its origin either at (lat,lon) = (-90,-180) or (-90,0). Andreash: the source projection is not something you choose; it is an inherent property of the data. You need to know it (or at least make an educated guess). If you guess wrong, your values could be way off, as om_henners suggests.
    – whuber
    Commented Jun 25, 2012 at 13:58
  • Despite having posted an answer, I am now wondering if perhaps your raster represents a quantity you would prefer to express per steradian or SI squared degree (relative to the earth's center) rather than per "square degree" of latitude and longitude, as I originally interpreted it. Please let us know if this is the case, because the answer would be (quite) different!
    – whuber
    Commented Jun 25, 2012 at 14:34
  • @whuber I know, and actually wanted to write "try to find out from the creators of the dataset which projection they used"
    – andreash
    Commented Jun 25, 2012 at 15:31

1 Answer 1

12

Almost all global rasters twice as long as high, and especially those with numbers of rows and columns being nice multiples of 180, use ("unprojected") geographic coordinates. Therefore this one almost surely uses square cells of 0.1 degree. Please confirm this in the grid's metadata if possible.

The conversion from square degree to square meter depends on latitude (but not on longitude). The most accurate way to perform the conversion is to create a sequence of 0.1 by 0.1 degree polygons extending along a meridian from the equator to a pole, project those with an equal-area projection, and compute the areas in square meters. Join those areas to the grid's attribute table (using latitude as the key), then multiply the grid values by those areas and multiply the answer by 100.

We can anticipate the answers to about four significant figures by using a spherical (instead of ellipsoidal) earth model. A simple equal-area projection is cylindrical (geometrically projecting outward from the earth's axis onto an enclosing cylinder): this sends a point at (lon, lat) to (lon, sin(lat)). Thus, a square of width dl (in longitude) bounded below at a latitude f and above at a latitude f + df is projected onto a rectangle of width dl and height sin(f+df) - sin(f). Taking dl = df = 0.1 degree gives the area as

0.1 * (sin(f+0.1) - sin(f))

square degrees. (Calculus tells us that 0.1 * 0.1 * cos(f+0.05) * pi/180 is a good approximation to this, accurate almost to seven significant figures.)

To convert these degrees to meters, note that the radius of a sphere whose area is equal to that of the earth's ellipsoidal surface (an authalic sphere) is 6371 km, giving 111,194.9 meters per degree. That means a (nominal) square degree has an area of 111194.9^2 = 1.22364E+10 square meters. Therefore any quantity expressed as a density per square meter must be multiplied by 1.22364E+10 * (180/pi * (sin(f+0.1) - sin(f)) / 0.1) to convert it to a density per square degree. (Incidentally, as a double-check, this difference of sines should start around pi/180 = 0.01745 near the equator and smoothly decrease to zero at the poles; the entire expression (180/pi * (sin(f+0.1) - sin(f)) / 0.1) starts at 0.999999 at the equator where f=0 and decreases to .000873 at the pole where f=89.9. The strange quantity 180/pi is required to convert from radians to degrees.)

This calculation is straightforward to do using standard grid "map algebra" expressions (in GRASS/QGIS, ArcGIS, Manifold, Idrisi, R, or whatever): f needs to be a grid of either latitude values or row indexes and the rest is all done with pointwise ("local") operations.

8
  • 3
    It seems prudent to remark that a density per square degree is a strange quantity to work with, almost without scientific meaning. For instance, something that is uniformly spread across the earth should be thought of as having constant density, whereas its density per square degree will decrease away from the equator and become practically zero at the poles.
    – whuber
    Commented Jun 25, 2012 at 14:10
  • cant get this to operate, end up with many negative values when multiplying various latitudes using 12.2364 E+10 * (180/pi * (sin(f+0.1) - sin(f)) / 0.1)
    – Sam
    Commented Mar 26, 2020 at 13:52
  • @Sam You're probably not using sin correctly: look up its usage in your software documentation and check whether its argument is expected to be in degrees or radians.
    – whuber
    Commented Mar 26, 2020 at 14:31
  • yes, it is the first thing i checked - R is radians for sin(). still, can't get away from negatives when using a -89.95 to 89.95 trajectory along a meridian
    – Sam
    Commented Mar 26, 2020 at 14:59
  • 29 0.1 degree cells on a 0 deg longitude have negative area (-0.03 km2 to -6 km2), latitude 87.15 to 89.95. Using R. Thanks
    – Sam
    Commented Mar 27, 2020 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.