Cause of oddly pixelated map?

Added by Ron about 1 month ago

Hi all,

I am trying to create a Geoid map of Mars.
I have the tabulated values to turn into a grd file and I do this properly in the GMT code. I have created a color palette to go a long with the data set's minimum and maximum.
However, when I run the code, I get an oddly pixelated image.

Is there anything I am doing wrong in my GMT code that creates this?

GMT CODE:
gmt xyz2grd MarsGeoid2.txt -GMarsGeoid2.grd -I0.25/0.50 -R0/360/-90/90 -hi1 -r -V -:
gmt grdimage MarsGeoid2.grd -CGeoid.cpt -JW0/5.0i -R0/360/-90/90 -Y8.7i -P -K -V > MarsMaps2.eps
gmt psscale -CGeoid.cpt -Dx2.5i/-0.1i/4.6i/0.1h -E -O -P -V >> MarsMaps2.eps

Attached is the image I get.

Thanks for any help.

pixelatedodd.jpg (106 KB)


Replies (10)

RE: Cause of oddly pixelated map? - Added by Joaquim about 1 month ago

Clearly there is an issue with the

gmt xyz2grd MarsGeoid2.txt -GMarsGeoid2.grd -I0.25/0.50 -R0/360/-90/90 -hi1 -r -V -:

command (the -r?) but cannot know what. Why are you passing through an ascii file? Normally these products come in binary grid formats.

RE: Cause of oddly pixelated map? - Added by Ron about 1 month ago

Through the manual of xyz2grd I see that the -r command is the likely culprit here.

I'm not entirely sure what you mean by your question, but the MarsGeoid2.txt file that I am trying to pass through in xyz2grd has the following format:
-89.750 0.250 -0.986091303391E+02
-89.750 0.750 -0.985847441926E+02
-89.750 1.250 -0.985603898332E+02
-89.750 1.750 -0.985360691243E+02
-89.750 2.250 -0.985117839289E+02
-89.750 2.750 -0.984875361094E+02
-89.750 3.250 -0.984633275279E+02
-89.750 3.750 -0.984391600452E+02
-89.750 4.250 -0.984150355216E+02
-89.750 4.750 -0.983909558160E+02

And it continues on, we have Lat/Long/Geoid here.

Thank you so far for your help.

RE: Cause of oddly pixelated map? - Added by Joaquim about 1 month ago

My question was, why are you using ans ascii xyz file instead of a binary grid?

Try this: rename MarsGeoid2.txt to MarsGeoid2.xyz

grdinfo MarsGeoid2.xyz

RE: Cause of oddly pixelated map? - Added by Ron about 1 month ago

Hm, I renamed MarsGeoid2.txt to MarsGeoid2.xyz and then changed that part of the code and ran it, but nothing changed.

I then ran gmt grdinfo MarsGeoid2.xyz in terminal and it gave me this:

:~/Desktop$ gmt grdinfo MarsGeoid2.xyz
ERROR 1: Ungridded dataset: At line 721, change of Y direction
grdinfo (GMTAPI_Import_Grid): Not a supported grid format [MarsGeoid2.xyz]
[Session gmt (0)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
[Session gmt (0)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
[Session gmt (0)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)

In MarsGeoid2.txt, line 721 is where the second column (longitude) goes from 360 degrees to 0 degrees.
Does this have anything to do with it?

Thank you again.

RE: Cause of oddly pixelated map? - Added by Joaquim about 1 month ago

Sorry, vacations did their job. I missed an important bit. To force the reading through GDAL. Try this

grdinfo MarsGeoid2.xyz=gd

RE: Cause of oddly pixelated map? - Added by Ron about 1 month ago

Hm, this is the error message I receive now:

:~/Desktop$ gmt grdinfo MarsGeoid2.xyz=gd
ERROR 1: Ungridded dataset: At line 721, change of Y direction
grdinfo: Unable to open MarsGeoid2.xyz.
grdinfo: ERROR reading file with gdalread.
grdinfo (GMTAPI_Import_Grid): Could not open file [MarsGeoid2.xyz=gd]
[Session gmt (0)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
[Session gmt (0)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
[Session gmt (0)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)

Right now I am just typing in "gmt grdinfo MarsGeoid2.xyz=gd" into the terminal and that is the error message it returns.

RE: Cause of oddly pixelated map? - Added by Joaquim about 1 month ago

So you have the answer. Your MarsGeoid2 file is not a grid and hence cannot be reformatted by xyz2grd nor read by the GDAL driver.
I asked you before, where does it comes from?

RE: Cause of oddly pixelated map? - Added by Ron about 1 month ago

This file is created through another program. We take the Mars gravity coefficients and expand them into an anomaly (in this sense the Geoid anomaly). It then gives us back what should be a gridded data set.

I've attached MarsGeoid.txt which is essentially the same sort of data set (the difference between MarsGeoid.txt and MarsGeoid2.txt is MarsGeoid uses 1 degree while MarsGeoid2 uses 0.5 degree intervals). Both of these files do not work in the code.

With the file attached, is there anything you see in the file that would signal it is not a gridded data set?

Thank you,
Ron

MarsGeoid.txt Magnifier (2.41 MB)

RE: Cause of oddly pixelated map? - Added by Joaquim about 1 month ago

Your file is yxz (lat lon z) instead of xyz. Use -:

This works

xyz2grd MarsGeoid.xyz -Rg -I1 -: -r -Glixo.grd

RE: Cause of oddly pixelated map? - Added by Ron about 1 month ago

BOOM! That did it.

Thank you very kindly for taking the time to help me with this issue.

For reference, the code that did it for me was:

gmt xyz2grd MarsGeoid.xyz -Rg -I1 -: -r -Glixo.grd
gmt grdimage lixo.grd -CGeoid.cpt -JW0/5.0i -R0/360/-90/90 -Y8.7i -P -K -V > MarsMaps3.eps
gmt psscale -CGeoid.cpt -Dx2.5i/-0.1i/4.6i/0.1h -E -O -P -V >> MarsMaps3.eps

And the output is attached.

GeoidMars.jpg (39.3 KB)

(1-10/10)