Is there any world map with altitude using TH2?

Hi all, I need a world map using TH2 class with altitude as z axis.
The higher the accuracy, the better, like grid ~100m, 30m, or better

You can do maps with TH2Poly but I guess you won’t find more than outlines of countries or continents (see, e.g. ROOT: tutorials/hist/th2polyEurope.C File Reference and ROOT: tutorials/hist/th2polyUSA.C File Reference) and it cannot contain details inside each polygon (unless you add inside a polygon for each “pixel” of the resolution you want, if that’s possible). I would say a “normal” TH2(F/D…) is out of the question, too --even if you had all the data, just calculate how many bins you would need for the resolution you want.
What you need is a different kind of data, files (probably netCDF files) and software, so I think you should look into GIS data sources and software.

OK, it seems I must convert the GIS format to root by myself

If you search this forum for “netCDF”, a few old posts come up, but I don’t know if it works in ROOT.

Actually I have it as a TH2POLY. Are you interested ?

Also there is this tutorial using histograms:
https://root.cern/doc/v630/earth_8C.html

I guess that’s for @cxwx1 ? If i’s for me (your comment is replying to one of mine), I don’t think I need it at the moment, but we never know, so thanks, it’s good to know this exists :slight_smile:

yes sorry. I replied to the last post …

Yes I know, TH2POLY is also needed.
but there is no altitude info with TH2POLY.

You can fill each bin with some “altitude”. But each country (as there is one bin per country) will have single altitude. May be the earth.C example is more appropriate in you case (with more bins)

I’ve try a geo file with 43200x21600 pixels,
but if I set a TH1F with 43200x21600 bins

it cause

Fatal in <TBufferFile::WriteFastArray>: Not enough space left in the buffer (1GB limit). 933249604 elements is greater than the max left of 536870758

Can I extern the max lefts?

It seems ok for me:

root [0] auto h2 = new TH2F("h2","h2",43200,0,1,21600,0,1)
(TH2F *) 0x7fed0646ce00
root[1]

yes, but I cannot use

  h2->Write();
  fout->Close();

Yes that seems a internal limitation. I guess @pcanal can comment. There is also this:

If you use a TH1S instead of TH1D, then it may fit in the 1GB limit.
Otherwise, you will need to use less bins.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.