-
Notifications
You must be signed in to change notification settings - Fork 398
Implement DCW collections and allow full continent, country, and state names in -R -E #6064
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
Conversation
DCW collections are named groups of countries (or states) that can be requested via their abbreviation or full name. DCW will ship with some standard collections but users can add their own in ~/.gmt/dcw-collections.txt which has the format # ANy number of comments tag: abbreviation [full name] XX,YY,ZZ,WW,... where the XX etc are valid DCW tags. Any number of tag/list sequences are allowed.
|
I added a listing modifier +n to list available collections, i.e.
If you give a country or countries it will only list collections that contains that country:
should find Scandinavia, Nordic Countries, etc. This assume there are such collections of course |
|
Great Paul BTW, I try to use "" for the names and I get an error: |
|
Try no quotes inside the file, and only use quotes if there are spaces on the command line. |
Great. Now works. For the record: |
|
So, this seems to work fine. Should I approve the PR? Also, I was thinking that maybe we could add the full name for countries (e.g. |
Not yet. We will wait until the dcw-collections.txt have been reviewed by the team.
That file should be added to the dcw-gmt repo where the country and state lists are.
Those regions are more like named region with a corresponding -Rw/e/s/n string and does not have anything to do with DCW per se. Not sure, but it would be a different file, such as gmt-regions.txt with records like But maybe we do add it to DCW so that -E+n can list them as well - they are just different in that it is just a shorthand for a w/e/s/n setting, but the padding via +r|R still applies to those regions. So make a separate dcw-regions.txt file for dcw-gmt repo instead.
OK, those names are already in the DCW tables so this is a software update in GMT only, |
|
Just a thought: this feature is now hard linked to Like: Edit: And I see Paul has commented on this in #6064 (comment). |
|
Minor comment: Ability to separate blocks with an empty line - pure cosmetical/convenience. Especially nice if it's possible to define Alright - remote empty line and check again: The |
|
How is the user supposed to add entries? Edit |
|
The dcw-collection is read only for users. They instead edit a dcw-groups.txt file in their ./gmt directory |
|
Ok, so the dcw-collection is made by the devs with a set of assumed relevant/interesting areas. |
Yes, that is my idea. The user then, can modified or add the records on that file. About the list, I think we should follow some guidelines. I am thinking on:
Some doubts:
|
|
Just so we are clear, there are for now two separate files: dcw-collections.txt comes with the DCW installation and is a list of things we developers wishes for all to have access to. Then, users can extend that reach by adding their own dci-groups.txt file to ~/.gmt. We can discuss if both files should be called dcw-collections.txt which may be more consistent. There seems also to be a need for a list of named regions that are shorthands to specific -Rw/e/s/n settings. We can worry later if those should also go into the same file or a separate file. I can code it either way. But likewise, we should supply some basic well known cases in the DCW repo distribution and then users can create their own extensions to that. |
|
Here there is the sub-regions use by the United Nations: |
Yes, that list plus your 9-10 oceanic regions would be a good set of named regions for DCW to provide. Then users can add odd regions are they see fit. So, since we don't want the users to deal with too many files, perhaps both the current tag and the naemd region should be in a single file with mix and match. Perhaps this is the format of dcw-collections.txt: That means we have ~30 named entries supplied via DCW and the E+n will list them. I can make the code changes later today, including skipping blank lines as per @anbj. |
|
Update: Here are some changes:
|
I see that the UN region are follow the below code where each region is defined by 3 numbers. So we get this for example: Also, there are some major sub-regions. For example sub-saharan africa which includes four sub-regions (western africa, central africa, southern africa, eastern africa). Another major sub-region is Latin American and the Caribbean. I am not including them, |
|
Do we want to use UN029 instead of 029? I worry that giving an integer will cause trouble with the -R parsing. Currently it checks for letters. |
|
Yes, I will add it. I get an error for -R (but not for -E). |
If I create a tag with lowercase: Change the tag's first letter to uppercase (but don't change tag in Change tag (in And it works fine: So seems that it is important that the first letter is uppercase. If you change one of the other letters to uppercase you get trouble: Starting to nitpick now.
Both and runs fine (but same issue with letter case as descibed above). |
|
Error fixed, @Esteban82 |
Thanks. Now there is the issue that anbj reported. With Another issue is that the list follow the original order of the dcw-collections.txt which is not alphabetically and can be confusing for the user. |
|
If a run BTW, I noticed that some regions have the same name that collection of countries. |
|
Try this update. |
It works. Now I have to update dcw-collections.txt |
|
OK, so I can merge this branch then? |
I think that anbj comment wasn't fix. Shortly, If I run |
|
Ok, after dinner |
|
I think I have fixed @anbj's problem, perhaps @Esteban82 can check - I am off for a few hours on an errand. |
Great. Now it is fixed. So the code basically search the string in Codes and in names, right? BTW I just noticed that I can make this which is good. |
|
Given 2.1.0 has been released I think it is OK to approve and merge this branch. Stuff seems to work, e.g. Any remaining issues, @Esteban82 ? |
|
Sorry, missed seeing the approval. Merging |
|
Nitpicking: If you define a non-existing code, and at least one existing code, you get a nice warning. If you only define a single non-existing code, you will get a lon/lat- and projection errors, in addition to the warning. |

DCW collections are named groups of countries (or states) that can be requested via their abbreviation or full name. DCW 2.0.2 will ship with some standard collections but users can add their own in _~/.gmt/dcw-groups.txt which must have the format
where the XX,YY etc are valid DCW tags. Any number of tag/list sequences are allowed. As a simple example, these two lines adds the collection of Scandinavian countries:
Once can then use the collection in one of two ways:
While deveopers will work on suitable collections to distribute as offical names, interested users can play with this branch and create collections as described. I have placed an empty dcw-collections.txt file on the data server so that we avoid errors when GMT tries to download a missing system file.
For now there is no listing option provided, but this will come later. Closes #5742.