-
Notifications
You must be signed in to change notification settings - Fork 342
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 fix grdgdal access via MEX #2890
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not have to do anything special here but call GMT_Read_Data. It will figure out if you are passing it a GMTAPI tag. The object[0] most certainly will cause trouble since you do not know it is 0. It may be 6, or 3, or 44. So don't get into the weeds like that. GMT_Read_Data does its own GMT_Init and Begin and End IO so no need to have those either.
If I do the part in the |
Your fatal error is object[0]. You are making an assumption that is 100% incorrect. |
But that it's in this branch. On master I have not the |
I will look at the master. |
The master is like the |
You should add a if (GMT_Destroy_Data (API, &D)) { Can you give me an example/data that I can run and fail with in mex? |
Funny, I'm not able to reproduce it now. It first happen in Mirone where it will take longer to tray to reproduce, but it happened in command line too. But not now! |
Shit came back. It's something of this form but this
|
OK, I need data files to test this. |
You cannot. You don't have that |
But note that it's clearly related to the libarified functions. When I use the GMT nearneighbor the error does not show up.
|
Can it be in |
Yes. If that grid is Created with no data, then if you do Grid->data = tmp to write out, you need to set |
You mean, line 195 should not have an |
Yes, just set it to NULL since it clearly was set to tmp above. |
For init_open, would be more readable if the mode argument was GMT_IS_GRID or GMT_IS_DATASET instead of nebulous 0 and 1. |
Nope, because then
|
I am looking at save_grid_with_GMT. There is nPixelSize yet Grid->data is float. Since nPixelSize must be 8 why is it even a variable? And if it is not 8, don't you need to check and convert? Also, if you are "Writing" to memory here then yes cannot set data = NULL but then you need to allocate memory? Or use GMT_VIA_MATRIX probably. Cannot play too fast and loose with pointers like that otherwise. |
Why are you doing a calloc in line 177 instead of a GMT_Create_Data with GMT_DATA_ONLY as arg to add the missing ->data array? You are in GMT, allocating arrays for GMT but not telling GMT about it. |
Yes, I need to test I used a calloc because that was memory passed to GDAL to get back the result. Close to what is done is gdalread. |
OK, but tmp cannot be anything but float for GMT, so at least you will need to check if nPixelSize is 8, and if not you need to take some action, like creating a float array and copy over. Second, it looks like GDALRasterIO is putting the values into tmp, like any other function. So I dont understand why that cannot be GMT-allocated memory since there is no realloc etc going on with tmp. That way, tmp is not needed (just allcoate grid and pass Grid->data) and no longer an issue I think. |
Yes, passing Grid->data should be fine. Tomorrow. |
Found the issue with the |
Could you give me more info on when input is grid versus dataset so I can try to fix the KEYS? |
I think only the gdalgrid takes datasets. All others take grids. You can confirm by seeing which gdal modules it wraps.
On my way to Lisbon but by car. Avoid crowds is the present rule.
…Sent from my iDedo
No dia 13/03/2020, às 18:33, Paul Wessel ***@***.***> escreveu:
Could you give me more info on when input is grid versus dataset so I can try to fix the KEYS?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Outdated proposal. Closing. |
I think this is solved |
Yes |
Something is breaking the MEX interface. Even with the changes in this branch the NN algo works once but next time I try to open a file via GDAL it errors. Apparently via Julia things work fine.