-
Notifications
You must be signed in to change notification settings - Fork 361
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
Increase information encoded in virtual file names #2861
Conversation
All memory containers passed around as virtual files have names like @GMTAPI@-###### but this PR expands that to @GMTAPI@-#-#-#-#-##-#-######, where in addition to the 6-digit object code we also encode information like primary vs secondary input, direction, family, actual familly, geometrry, and messenger. This will allow us to quickly learn about an object with out excessive and repetitive validations. Also replaced GMT_STR16 with GMT_VF_LEN which is now of length 32.
Since we process the command line files separately in a program loop both g*math modules need to pass GMT_VIA_MODULE_INPUT to GMT_Read_Data.
Hope @joa-quim can give this a try with Julia for the grdmath and blockm* cases. |
Looks like I'll have to revisit my MB built (a potential big pain). With this branch I get
|
Might be worth it. Some months ago we added gmt_core_module.c etc functions to report both classic and modern names. Perhaps some naming changes is behind your error. |
I suspect more that I was using some GMT5 API thing that now is gone. I don't get that error with master branch. |
Maybe thinks like header->nx instead of n_columns? |
Maybe, but those should raise compiler errors. |
True. When checking what special gmt_supplements_* function we have I find this:
So I think your mb build should have the same module calls. They have changed a bit since our structure now contains both classic and modern names. |
Well, I was not rebuilding the mb supplement. Now I'm getting many compiling errors. Let's see if it simple to clear them. |
Seems we changed the |
That was many moons ago though. |
We removed something related to pthread in CMake scripts didn't we? I have tons of these
|
What happens is that I have this
but now the use of |
Maybe @seisman can advice on the pthreads and EXTRA_INCLUDE_*, but for non-GMT shared libraries they should build separately and only link with the GMT libraries, no. E>g., see gmt-custom for building a separate shared lib the needs GMT. |
For Linux/macoS the mbsystem installer builds the shared library, so this is a Win only thing. You should not need any Cmake stuff really, and just have a batch script or similar that does its thing? |
BTW, I need to so some work on gmt-custom it seems. |
Yes, pthread was removed in #1937. If mbsystem needs pthread, you probably need to add the cmake snippet back to the CMakeLists.txt of mbsystm.
We changed |
I think the main thing is that any supplemental requirements shall go into the setup or CMakeLists.txt for the supplemental library, not GMT itself. |
FYI, the gmt-custom was moved to git and renamed custom-supplements. I will update it for GMT6 now. |
The MB Win build would be an act of pure masochism if I didn't need it for classes. Everything works to break it all the time. |
OK, I will be updating custom-supplements, hopefully with @seisman's help, to make it simpler to create custom supplements. Not clear to me if this will help you or not, though. |
No, it's not to build a custom supplement that I'm after but I made it build again the MB+GMT. Will need to test it but not now. Meanwhile the grdmath issue became a little worse. This now crashes Julia
|
But go ahead and merge this. We'll deal with the other issue after. |
Does work for gmt mex though. Perhaps your *.jl code needs an update since I made changes in gmt.h and gmt_resources.h, including changing the GMT_STR16 to GMT_VF_LEN 32? |
Don't know what but this branch broke GMT.jl |
I am pretty sure you have told me in the past that you need to make Julia changes if I change anything in gmt.h and gmt_resources.h. Did you do those? |
Found it. It was the change in |
PyGMT fails with the latest GMT master branch with the following error message: ``` GMTCLibError: Constant 'GMT_STR16' doesn't exits in libgmt. ``` To reproduce the issue, you can run: ``` import pygmt fig = pygmt.Figure() fig.basemap(region='0/10/0/10', projection='X10c', frame=True) fig.plot(x=5, y=5, style='c0.2c') ``` The error is caused by the recent change of the length of virtual file names from `GMT_STR16` to `GMT_VF_LEN` in the core GMT (see GenericMappingTools/gmt#2861). Changing `GMT_STR16` to `GMT_VF_LEN` is the easiest fix. To keep compatibility with both GMT 6.0.0 and the upcomming 6.1.0, this PR checks GMT version and use `GMT_STR16` for 6.0.0, otherwise use `GMT_VF_LEN`.
….0 (#397) PyGMT fails with the latest GMT master branch with the following error message: ``` GMTCLibError: Constant 'GMT_STR16' doesn't exits in libgmt. ``` To reproduce the issue, you can run: ``` import pygmt fig = pygmt.Figure() fig.basemap(region='0/10/0/10', projection='X10c', frame=True) fig.plot(x=5, y=5, style='c0.2c') ``` The error is caused by the recent change of the length of virtual file names from `GMT_STR16` to `GMT_VF_LEN` in the core GMT (see GenericMappingTools/gmt#2861). Changing `GMT_STR16` to `GMT_VF_LEN` is the easiest fix. To keep compatibility with both GMT 6.0.0 and the upcomming 6.1.0, this PR checks GMT version and use `GMT_STR16` for 6.0.0, otherwise use `GMT_VF_LEN`.
Description of proposed changes
When memory resources are passed from one module to another, or when GMT modules are called from external interfaces (MATLAB, Julia, Python) we create a virtual file name that represents the memory container and whose encoded object ID allows us to find the memory. These names have the format
@GMTAPI@-######
. To prepare for a simpler scheme down the road I have extended the format of the virtual file names to@GMTAPI@-S-D-F-A-G-M-######
, where the extra letters convey information about primary/secondary data, input/output, what data type, the geometry, and if a dummy messenger container for output. Currently, this information is encoded in the virtual file name but only the object ID is decoded (as before). Over time I hope to decode some of the other information for data validation.In the process I fixed two issues: grdmath can now deal with dataset input for operators such as LDIST and INSIDE, and block*m modules can now return empty NaN grids if no data points fell inside the region. This PR closes #2476 and #2795.
Finally, I have abandoned the oldest functions and parameters used in the initial 5.2 API; This closes #2860. Three test programs have been removed since no longer testing anything useful.