-
Notifications
You must be signed in to change notification settings - Fork 367
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
WIP Try to adress #4003 as well as more underlying issues #4044
Conversation
FYI, I have a full day of Chair work so maybe afternoon |
I wonder if we should first split grdimage into three separate sub-functions:
As it is, it is so hard to try to follow the logic in grdimage. While this will set us back some days, might it not be a better and long-overdue update? I have 2 hours now before meetings start up again... |
I don't know if anyone is still using the 3 r,g,b grids. That's a so old tech. |
With grdmix we have a module that can take 3 grids and write an image. So we could decide to stop accepting 3 grids in grdimage (and grdview) and direct anyone with that type of data to run grdmix first. It would simplify grdimage a bit. I do not think there are tons of people doing 3 grids, and they could then do it that way instead. Alternatively, to not break backwards compatibility, we could have grdimage/view call grdmix first and get that image back. |
Yep, redirecting to |
So OK for you if I start some hacking later today on grdimage? |
Sure. |
If it means a lot of code changes, perhaps we should leave it to 6.2? |
Given there will always be bugs, we will never release 6.1.1 unless we just do it. I have not started on grdimage because of work (first week of classes has lots of meetings), so perhaps we should just wrap 6.1.1 as is. |
Yes to me. |
The large change could be left to after 6.1.1 but we still have #4003 that I've not been able to fix. And, you'll forgive me but why do we need a 6.1.1 and leave |
I think one reason for 6.1.1 is that it is likely to live in ubuntu and others for a long time before they move to 6.2. So it provides stability. As we are making it easier for people to install (note the auto-download for gshhg and dcw now) we could also add a plug on our website explaining why building the latest has lots of benefits (more bug fixes, more new features) than sticking with a point release. |
We also know from past experience that when we release a new module that only I have tried 4-5 times it is likely to have more bugs that your typical module, so having people play with it in master for some time is not a bad idea. |
Being 6.1.1 or 6.2 makes no difference to Ubuntu. They update versions based on their (slow) release schedule and use whatever is available then. Also, the building argument does not apply to > 50% users (Windowers + many). |
Seems like the GMT_Read_Data for images works differently for images and grids. it comes down to gmtapi_import_image versus gmtapi_import_grid. If I recall, I think both correctly read the header (this will return the w/e/s/n for the entire file) but when a grid is read we pass s_obj->wesn to limit the subset, whereas in gmtapi_import_image we do not. Hence the whole thing is read. |
I know you dont like the bug-release plan, but we in fact decided this a month ago to do a 6.1.1 and have spent lots of time prepping for that. |
That was my work in this PR but I'm stuck with the PAD (and more shits with pix-grid-reg probably). |
If you make a branch I might be able to look and help as well. More meetings coming up today though. |
I think we decided to release major versions every 6 months, and release minor versions if there are any critical issues. Following that release plan, we're still going to release 6.2.0 after six months of the 6.1.0 release. I don't remember the exact release plan, is it November? During any two major versions, we still release minor versions (like 6.1.1). |
This PR is in a branch |
If we have nothing new, we are not going to release a 6.x.0 |
Well, there has never been a time without new stuff. We keep adding features all the time, and often modules. |
I will try to look at this later today, to many student conferences during the first week of classes... |
One issue may be that some of the helper functions, like gmtgrdio_padspace, assumes that the reading function knows how to handle periodic data. Say your image is 0/360 and you want -30/45. Well, for grids we pass in -30/45 and the gmt_nc is smart enough to read the end of a row then padding with the beginning of the row to bet -30/45. I am not sure if gmt_gdalread works the same way? Also, because of padding, the 0/360 request can become -2/362 and it works fine with grids. So perhaps that is why you read the entire image and let the projection deal with it on the GMT side. |
You're right for the -30/45 case but my example case uses -85/-54 and in |
You can experiment with commenting out the pad check at top or
gmt_img_project in gmt_map.c
Sorry, have doctors apt and will be gone for part of the day.
Paul Wessel, Professor and Chair
Dept. of Earth Sciences
SOEST, U of Hawaii at Manoa
On August 26, 2020 at 4:13:01 AM, Joaquim ([email protected]) wrote:
You're right for the -30/45 case but my example case uses -85/-54 and in
gmtlib_read_image() the gmtgrdio_padspace() reads the pad zone from data,
but when projecting it still complains that pad is != 2
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4044 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGJ7IXZYVFQCLDKH7XS55HTSCUJ6ZANCNFSM4QJ3FDGA>
.
|
We fixed many API bugs after the 6.1.0 release. These fixes are very important for PyGMT. There are many pending PyGMT PRs/features waiting for a new release. Perhaps we can leave the issue #4003 to 6.2 and release GMT 6.1.1 ASAP if we can't fix it in a few days? |
Yes, agree that this issue should not hold the release. |
I wish to fix this problem now in 6.2. Currently, grdimage is too complicated to easily debug. Some of the complications are:
I think it is best to approach this mess is steps. The one vs three grids is a legacy from before we could use GDAL to read images. Having to deal with three vs one grid complicates our workflow. Because we need to be backwards compatible, I suggest we do the following first: Detect if we have one or three grids. If three, we call grdmix to obtain the equivalent image, and proceed to plot this image instead. I can make a test for this, implement the changes, and make sure everything else works after ripping out the 1-vs-3 part both in the code and documentation (I don't think we have any tests for this but we do for grdmix). Seems and OK start, @joa-quim ? |
Hm, I think this PR is being replaced by #4215, no? |
Most of the changes in this PR are outside |
OK, shall we remove WIP and merge this of is there more testing to be done. You are right, it is barely toughing grdimage.c so should be easy to merge. |
After merging in master into this PR I get many failures that all seem to happen in gdal:
For instance, ex19 crashes on middle panel when we use coast to fill using a pattern image. Crash happens in gmt_gdalread.c line 1058 because nYSize = nXSize == 0.
You can recreate the crash using this branch and running
so you can see what is happening. |
Hi @joa-quim, perhaps merge in master into this branch and give it a check again. It has lingered as a WIP for a while now. |
I have some urgent bugs to fix in Mirone. After it I'll give this another try. |
Still
|
Don't know what to do to fix this. Spend many hours debugging but just can't get rid of the pad shit. If the -R fits all inside then it's working already. One would only have to find a way to tell |
I think for grids without pad, the equivalent gmt_grd_project makes a temp grid with the pad so the interpolation can happen. Perhaps the same can be done for the images? |
Duplicating the entire image because of the pad is too crazy wasteful. |
Once I have time to come up for air I will debug to re-educate myself on what is happening there. |
It would be possible that this was fixed with #5798 ? |
Hi @joa-quim I am pretty sure this branch and PR can be deleted, no? This was dealt with a month or more ago (image subsets). |
Yes,to close. |
To start with I don't even understand how the bottom image in #4003 even works. Whatever makes it work must happen in the projection operations because linear projections fail as well. E.g, this fails.
But investigating this resurfaced the fact that when reading sub-regions of an image in fact loads the entire image and this is a NO NO.
This PR makes several changes to address that but still doesn't fully work. The PAD is a nightmare. Currently, this works
but this not
If I set the pad = 2, than no complains but image is screwed.
Curiously, this works and no complains with pad = 0.