-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
option DCW issue #1383
Comments
Hmm, can you please provide an example that I can reproduce? |
here is testing code.my intention is to plot figure with both grid lines and CA border.a file with projection is attached (tiff but zipped).thanks a lot.using GMT testing_path = "/mnt/hdd1/GRACE_data/Mascons_JPL"; inputfile1 = joinpath(testing_path, "Mascons_JPL_result.Tiff"); outputfile_out = joinpath(data_path1, "test1.png"); ############### version 1 #################### this produces figure with Canada border but without grid lines.topo = makecpt(color=:jet, range= (0, 960*1140, 10), continuous=true) #make colorbar other options: color=:polar ############# version 2 ############################### this produces figure with shorelines and grid lines.file_out = joinpath(data_path1, "test2.png"); |
Sorry, there seem to be issues here but I cant even reproduce your figures. This is what I get (which GMT.jl version are you using?)
|
I don't have an answer for now. This is a harder case where one have a projected grid and want to overlay coastlines that guess the right projection. This is a case that I've worked a couple times (fixing previous failures) but current version (1.10) seems to be behaving worst than the one you have for this case. I will need more time to understand what/why things are failing the way they are. |
Thanks a lot! Also to mention, I encountered these warning/errors when using grdimage. But the plot looks nice anyway regardless of these errors. ┌ Warning: Que exagero de cores ERROR 10: Pointer 'hTransform' is NULL in 'OCTTransform'. |
First warning (in portuguese, sorry) is due to the fact that your makecpt command generates |
OK, I found the regression and now I'm also able to reproduce your results. The issue seems ti lie deep in the GMT (C lib) interaction with GDAL. If you have a standalone GMT CLI, you'll see that this works (it uses the GMT syntax for establishing the projection)
but this one, that uses the PROJ4 syntax, prints many complains and ends up not plotting the grid lines.
|
Thanks. Could you share which version of GMT CLI you used? $ gmt coast -ECA+p0.225,black -R-122.913612/36.214964/-9.977657/62.430681+r -J+proj=lcc+lat_0=0+lon_0=-95+lat_1=49+lat_2=77+width=15c/0 -Bpa10f2g10 -BWSEN -Da -png lixo $ gmt coast -ECA+p0.225,black -R-122.913612/36.214964/-9.977657/62.430681+r -JL-95/0/49/77/15c -Bpa10f2g10 -BWSEN -Da -png lixo |
Hmm, this makes think you are using an old GMT version
what does this print?
Anyway the Julia wrapper install its own GMT version and that should be GMT6.5.0. The issue you reported roots on GMT itself and I fixed a couple days ago on the master (GMT's, not GMT.jl) version and tried to rebuild the GMT_jl package but the Yggdrasil built is now failing on MacOS and I have no idea why. |
Thanks for helping, - involving to fix problems upstream. I will test it using new version. name = "GMT" Binary program via Ubuntu 20.04: |
No, I'm afraid it's not that simple. You cannot test it with neither of the above. Options are: 1- A new GMT_jll build, but that needs understanding/getting support to know why now BinaryBuild fails on Macs 2- Or build GMT yourself from master and follow instructions in https://github.com/GenericMappingTools/GMT.jl/blob/master/src/GMT.jl#L31 |
I am able to see the difference between these two lines with gmt v6.4 in another machine . gmt coast -ECA+p0.225,black -R-122.913612/36.214964/-9.977657/62.430681+r -JL-95/0/49/77/15c -Bpa10f2g10 -BWSEN -Da -png lixo gmt coast -ECA+p0.225,black -R-122.913612/36.214964/-9.977657/62.430681+r -J+proj=lcc+lat_0=0+lon_0=-95+lat_1=49+lat_2=77+width=15c/0 -Bpa10f2g10 -BWSEN -Da -png lixo Before a bug can be fixed, is there a way to pass "-JL-95/0/49/77/15c" into grdimage (coast) in gmt.jl? For example: adding proj="L-95/0/49/77/15c" into coast:
However, this did not fix the problem (or see difference except the errors are gone). julia> x should I also change the property of x (x.PROJ)? Is there a way to modify the value of x.PROJ in julia, manually? Thanks. |
If you update your GMT.jl all of these problems should be solved now.
These two now give me the same plot with the foxed GMT (C), the same you get when you update GMT.jl
Yes but do not add the figure size. That is, this works
No need to use
No, but you can if you want. |
Thanks. I used "] add https://github.com/GenericMappingTools/GMT.jl" to add the latest GMT.jl. Now I was able to plot correctly with both grid lines and boundary from DCW (See attached), although some other packages could not be compiled. Two more questions here:
Is that designed so? file1 = joinpath(testing_path, "can-drainage-region-5km-lcc_tif.tif"); julia> size(x.x) julia> size(x.y) julia> size(x.z) |
The recommended way is to do
Yes they do and that part is correct. Please see the pixel vs grid registration at https://docs.generic-mapping-tools.org/dev/reference/options.html#grid-registration-the-r-option
Yes, I can confirm that. This type of plots are more complicated than they look at first. Here the grid is already projected and has to be plotted with a linear projection, but to have the frame in geographics one has to compute the right limits (-R) to pass to the |
Thank you very much. These are very helpful/useful! |
What I can tell you is that is the misfit is not due to a projection conversion error. If I reproject the border vector and overlay it with the My (current) strong suspicion is that the misfit is due to the fact that grid (or the image in my case) central longitude is not equal to the projections |
Any quick fix if this is the case: "that causes a slight rotation of the image that results in a wrong estimation of the -R parameter that is passed (under the hood) to the coast command"? Thanks. |
That suspicion was not confirmed. I have troubles understanding why (and where) this is failing. The fix should be to reproject the grid to geogs and redo the plot. |
wondering if an example can be provided: |
|
The DCW polygons yes. The GSHHG vectors also but they are not contiguous.
|
Might not be a bug. For the following code, if I add "DCW=(country=:CA, pen=(0.225,:black))", the Canada border will be shown, but the grid line (lat, lon) will not show.
If I remove "DCW=(country=:CA, pen=(0.225,:black))", the grid line shows well. Any reason why the country and grid line repel each other?
Thanks. Liming.
for yy = 1: 1
file_out = @sprintf("Pixel_%s_%04d.png", this_variable, year(year_list[yy]));
end
The text was updated successfully, but these errors were encountered: