'Georgetown' in UTC-3:00 - where is it exactly? [closed] - timezone

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 6 years ago.
Improve this question
I am trying to verify a timezone list from:
https://github.com/tamaspap/timezones
And I have noticed that there is a 'Georgetown' in UTC-3:00. But I am wondering where is the location of this 'Georgetown' exactly? I did searched on the Internet, but don't see any Georgetown in UTC-3:00?

This case is a perfect example of why one has to be very careful with building custom lists of time zones. The fact is, there are many cities named GeorgeTown.
In particular, there are two different cities being confused here.
Georgetown, Guyana - the capital city of that country
IANA time zone ID: America/Guyana
Time Zone Offset: UTC-4 (no DST)
Georgetown, Córdoba, Argentina - a suburb of the city of Córdoba
IANA time zone ID: America/Argentina/Cordoba
Time Zone Offset: UTC-3 (no DST)
It appears that the author of that time zone list was looking at other various time zone lists that have an entry for Georgetown. Perhaps it was one of these (or based on them):
The Windows operating system, which has an entry: Georgetown, La Paz, Manaus, San Juan
Rails, whose ActiveSupport:TimeZone list contains an entry for Georgetown
However, in both cases, the Georgetown being referred to is the one in Guyana, and the author of the project you mentioned incorrectly mapped it to Argentina, as seen in their source code:
'(UTC-03:00) Georgetown' => 'America/Argentina/Buenos_Aires',
They also chose the wrong sub-region within Argentina, but both are on UTC-3.

Related

TimeZone Abbreviation issue with new version of moment-timezone js package [duplicate]

This question already has answers here:
Getting the client's time zone (and offset) in JavaScript
(33 answers)
Get timezone abbreviation using offset value
(2 answers)
Closed 6 years ago.
Using Javascript, is there a way to get a user's timezone name (PDT, EST, etc.) based on the user's device?
Code I tried:
const timezone = jstz.determine()
const userTimezone = timezone.name()
But I would like to get back the user's timezone name in PDT, EST, etc. instead of America/New_York.
Using moment.js with the moment-timezone add-on, you can do the following. The results will be consistent regardless of browser or operating system, because the abbreviations are in the data provided by the library.
The example results are from a computer set to the US Pacific time zone:
var zone = moment.tz.guess(); // "America/Los_Angeles"
var abbr = moment.tz(zone).format("z"); // either "PST" or "PDT", depending on when run
DISCLAIMER
Time zone abbreviations are not reliable or consistent. There are many different lists of them, and there are many ambiguities, such as "CST" being for Central Standard Time, Cuba Standard Time and China Standard Time. In general, you should avoid using them, and you should never parse them.
Also, the abbreviations in moment-timezone come from the IANA TZ Database. In recent editions of this data, many "invented" abbreviations have been replaced with numerical offsets instead. For example, if your user's time zone is Asia/Vladivostok, instead of getting "VLAT" like you may have in previous versions, you will instead get "+10". This is because the abbreviation "VLAT" was originally invented by the tz database to fill the data, and is not in actual use by persons in the area. Keep in mind that abbreviations are always in English also - even in areas where other language abbreviations might be in actual use.

Is there a reputable source that provides mappings of UN/LOCODEs to Olsen Timezones?

I've been researching CLDR and IANA in order to find a centralized mapping of UN/LOCODEs to Olsen Timezones.
Ideally I would like to have for example:
+--------------+--------------------+
|un_locode |timezone |
+--------------+--------------------+
|USLAX | America/Los_Angeles|
+--------------+--------------------+
for every UN/LOCODE.
Are my nube skills failing me in understanding how to use these sources to reach my goal? (If so please help point me towards the scripting that would allow me to automate providing these mappings).
Or, do these sources fail to have the data correlation that I'm looking for? (If so please let me know if you have a reliable source).
We faced the exact same problem and hence had to provide a solution.
This solution involves linking the UN/LOCODES database with a geolocation/timezone database.
There are a few caveats to this approach that were captured by Matt Johnson's answer and the accompanying comments.
Namely:
the UN/LOCODE database of coordinates is not complete[1] and sometime has inaccurate data[2]
in some cases, a 1 to 1 mapping between the UN/LOCODE and a timezone is impossible due to the political nature of the timezones.
the two points above are worsened by the inaccuracy of free coordinates-to-timezone databases. It is helpful to get a dataset that also includes territorial waters so that ports timezones can be properly linked to the country they belong.
The following repository https://github.com/Portchain/un_locodes_sql contains the code to extract and link the data. It outputs a SQL file that can be imported into a PostgreSQL DB.
The geolocation/timezone data is based on the geo-tz[3] module which seems to source its data from timezone-boundary-builder[4].
Again, the list provided by our repository is of course incomplete and inaccurate. If you see any error in the data, please open a github issue and let's make an accurate, open source list of UN/LOCODE, coordinates and timezone information.
[1] For example, both Los Angeles and San Francisco, USA (USLAX & USSFO) are missing coordinates in the UN/LOCODE database.
[2] The petroleum port of Abu al Bukhoosh (AEABU) is situated in Abu Dhabi (UAE). Its coordinates in the UN/LOCODE database position the port right in the middle of the Persian Gulf (https://www.port-directory.com/ports/abu_al_bukhoosh/). When resolved, this causes the timezone to be unknown.
[3] https://github.com/evansiroky/node-geo-tz
[4] https://github.com/evansiroky/timezone-boundary-builder
The GeoNames free database of cities (which is available to download) provides: city names, latitude/longitude and, most importantly, timezone information. You can fairly quickly make your own database connecting this information with the UN/LOCODE code lists based on the name/country/coordinates.
I've not seen such a source. You could try to create one by mapping the lat/lon coordinates for those entries that have them, and correlating to IANA time zone by one of the methods listed here.
However, be sure to read Wikipedia's article about UN/LOCODE, especially describing errors with coordinates. Also note that many of the coordinates simply not in the data - why? I don't know.
The list of UN/LOCODE for the US is here, and show Los Angeles to be US LAX (not UNLAX). Its coordinates field is blank.
If you can find some other reliable source of UN/LOCODE to lat/lon, then you are in business. A quick search found that GeoNames claims to have this in their premium data subscription, but I haven't investigated further.
CLDR's map is here: https://unicode.org/reports/tr35/#Time_Zone_Identifiers
I saw CLDR tagged but not mentioned.

computervision: nudity detection solutions comparision (opencv based or custom code) & hash-lists & client side [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
server side:
List item:
...: x% matches found, y% false positives (opencv +10 lines of code)
...: x% matches found, y% false positives (large custom code since 1995)
another:
Minimal OpenCV C++ code:
....
....
hash lists:
..: (financed by public money, restricted access as of ...)
...: (open access)
...: , y million entries, y % new last years (commercial $y / month)
...: , x million entries, x % new last years (commercial $x / month)
(serverside &) crowdsourced / crowd-verified:
Google images' filter: ... (restricted access, yet not even in webmastertools for owned websites)
client-side:
another: ... (will scan x megapixels per 50ms on a i5 2540 mobile)
nude.js (patrick-wied): ...
I completely rewrote this question, which was always closed and apparently appeared to be to wide rather than specific and "promote a link" rather than alternatives?
Task here now is to:
"Take inventory of all the worlds existing approaches for this development specific but widely unknown task."
(= to fill the gaps in the table above and maybe sample code/implementations)
While some windows software is marketed to parents whose kids surf the net,
this assumable wont anytime soon appear in a wikipedia article
"Comparision Of Nudity detection software" and from a development perspective. (nor on alternative.to/... )
also this is specific, yet widely underserved nor practiced.
Thus no single answer/link would be anything much of self-promotion/spam, this question on the contrary is prone to such less than the average question. Yet there dont need to be any links at all and there wont be answers with personal opinions and if there could be it would help more than nothing.
To run nude.js, check out the examples on this site.
Essentially, you need to include the JS files, and then run the checking algorithm on the images you want to run it on. There are 3 functions: nude.init() nude.load(param) and nude.scan(function optional).
From the linked example site:
nude.load(node);
// Scan it
nude.scan(function(result){
alert(result ? "Nudity found in " + node.id + "!" : "Not nude");
});
It's also worth noting that an article from the developer recommends not using it in production mode.
I wouldn’t recommend using the library in production mode right now
because the detection rate is about 60%
You may want to check out the links on this question and answers on SO for alternatives.

About the inference result of Blei's lda-c-dist [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a question about the inference result of lda-c-dist package. How many words should be displayed when viewing results of inference? For example, if I set number of words to a very large number N(assume number of all terms are N), it seems to exist some groups of words. In each group, the index of words are ranging from 1 to N.
What I got is like,
Assume number of terms is 10, and I assign the number of words displayed to 10.
Topic 0xx:
001
008
009
002
003
007
000
004
005
006
It seems that, may be I should set words displayed 3, not 10.
So, as to one topic, when viewing topics by calling topics.py, how many words should be specified?
Besides, I'm going to use this output to calculate the similarity of two topics. So ...
Actually, there can be as many items as the vocabularies are. What is displayed here, is just a probability descending order for a limited number indicated.

Mapping US zip code to time zone [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
When users register with our app, we are able to infer their zip code when we validate them against a national database. What would be the best way to determine a good potential guess of their time zone from this zip code?
We are trying to minimize the amount of data we explicitly have to ask them for. They will be able to manually set the time zone later if our best guess is wrong. I realize zip codes won't help with figuring out the time zone outside the US, but in that case we'd have to manually ask anyway, and we deal predominantly with the US regardless.
I've found a lot of zip code databases, and so far only a few contain time zone information, but those that do are not free, such as this one. If it's absolutely necessary to pay a subscription to a service in order to do this, then it will not be worth it and we will just have to ask users explicitly.
Although language isn't particularly relevant as I can probably convert things however needed, we're using PHP and MySQL.
I just found a free zip database that includes time offset and participation in DST. I do like Erik J's answer, as it would help me choose the actual time zone as opposed to just the offset (because you never can be completely sure on the rules), but I think I might start with this, and have it try to find the best time zone match based on offset/dst configuration. I think I may try to set up a simple version of Development 4.0's answer to check against what I get from the zip info as a sanity test. It's definitely not as simple as I'd hope, but a combination should get me at least 90% sure of a user's time zone.
Most states are in exactly one time zone (though there are a few exceptions). Most zip codes do not cross state boundaries (though there are a few exceptions).
You could quickly come up with your own list of time zones per zip by combining those facts.
Here's a list of zip code ranges per state, and a list of states per time zone.
You can see the boundaries of zip codes and compare to the timezone map using this link, or Google Earth, to map zips to time zones for the states that are split by a time zone line.
The majority of non-US countries you are dealing with are probably in exactly one time zone (again, there are exceptions). Depending on your needs, you may want to look at where your top-N non-US visitors come from and just lookup their time zone.
I created an Open-Source (MIT licensed) MySQL database table that cross-references zip codes and timezones and uploaded it to sourceforge.net:
http://sourceforge.net/projects/zip2timezone/files/
It is sourced from four locations (primary Yahoo PlaceFinder API - thanks #Chris N)
See the README file for more information and instructions.
If you want, you can also get a feel for the timezone by asking the browser
Josh Fraser has a nice write up on it here
var rightNow = new Date();
var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);
var temp = jan1.toGMTString();
var jan2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
var std_time_offset = (jan1 - jan2) / (1000 * 60 * 60);
The second thing that you need to know is whether the location observes daylight savings time (DST) or not. Since DST is always observed during the summer, we can compare the time offset between two dates in January, to the time offset between two dates in June. If the offsets are different, then we know that the location observes DST. If the offsets are the same, then we know that the location DOES NOT observe DST.
var june1 = new Date(rightNow.getFullYear(), 6, 1, 0, 0, 0, 0);
temp = june1.toGMTString();
var june2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
var daylight_time_offset = (june1 - june2) / (1000 * 60 * 60);
var dst;
if (std_time_offset == daylight_time_offset) {
dst = "0"; // daylight savings time is NOT observed
} else {
dst = "1"; // daylight savings time is observed
}
All credit for this goes to Josh Fraser.
This might help you with customers outside the US, and it might complement
your zip approach.
Here is a SO questions that touch on getting the timezone from javascript
Google has a specific API for this:
https://developers.google.com/maps/documentation/timezone/
eg:
https://maps.googleapis.com/maps/api/timezone/json?location=40.704822,-74.0137431&timestamp=0
{
dstOffset: 0,
rawOffset: -18000,
status: "OK",
timeZoneId: "America/New_York",
timeZoneName: "Eastern Standard Time"
}
They require a unix timestamp on the querystring. From the response returned it appears that timeZoneName takes into account daylight savings, based on the timestamp, while timeZoneId is a DST-independent name for the timezone.
For my use, in Python, I am just passing timestamp=0 and using the timeZoneId value to get a tz_info object from pytz, I can then use that to localize any particular datetime in my own code.
I believe for PHP similarly you can find "America/New_York" in http://pecl.php.net/package/timezonedb
Ruby gem to convert zip code to timezone: https://github.com/Katlean/TZip (forked from https://github.com/farski/TZip).
> ActiveSupport::TimeZone.find_by_zipcode('90029')
=> "Pacific Time (US & Canada)"
It's fast, small, and has no external dependencies, but keep in mind that zip codes just don't map perfectly to timezones.
This will download a yaml file that will map all timezones to an array of their zipcodes:
curl https://gist.githubusercontent.com/anonymous/01bf19b21da3424f6418/raw/0d69a384f55c6f68244ddaa07e0c2272b44cb1de/timezones_to_zipcodes.yml > timezones_to_zipcodes.yml
e.g.
"Eastern Time (US & Canada)" => ["00100", "00101", "00102", "00103", "00104", ...]
"Central Time (US & Canada)" => ["35000", "35001", "35002", "35003", "35004", ...]
etc...
If you prefer the shortened timezones, you can run this one:
curl https://gist.githubusercontent.com/anonymous/4e04970131ca82945080/raw/e85876daf39a823e54d17a79258b170d0a33dac0/timezones_to_zipcodes_short.yml > timezones_to_zipcodes.yml
e.g.
"EDT" => ["00100", "00101", "00102", "00103", "00104", ...]
"CDT" => ["35000", "35001", "35002", "35003", "35004", ...]
etc...
I've been working on this problem for my own site and feel like I've come up with a pretty good solution
1) Assign time zones to all states with only one timezone (most states)
and then either
2a) use the js solution (Javascript/PHP and timezones) for the remaining states
or
2b) use a database like the one linked above by #Doug.
This way, you can find tz cheaply (and highly accurately!) for the majority of your users and then use one of the other, more expensive methods to get it for the rest of the states.
Not super elegant, but seemed better to me than using js or a database for each and every user.
In addition to Doug Kavendek answer. One could use the following approach to get closer to tz_database.
Download [Free Zip Code Latitude and Longitude Database]
Download [A shapefile of the TZ timezones of the world]
Use any free library for shapefile querying (e.g. .NET Easy GIS .NET, LGPL).
var shapeFile = new ShapeFile(shapeFilePath);
var shapeIndex = shapeFile.GetShapeIndexContainingPoint(new PointD(long, lat), 0D);
var attrValues = shapeFile.GetAttributeFieldValues(shapeIndex);
var timeZoneId = attrValues[0];
P.S. Can't insert all the links :( So please use search.
See these links for the Olson database:
http://en.wikipedia.org/wiki/Tz_database
ftp://ftp.iana.org/tz/tz-link.html (yes, ftp) http://www.twinsun.com/tz/tz-link.htm
ftp://ftp.iana.org/tz/releases ftp://elsie.nci.nih.gov/pub/
https://iana.org/time-zones
Also note, that if you happen to be using Yahoo geocoding service you can have timezone information returned to you by setting the correct flag.
http://developer.yahoo.com/geo/placefinder/guide/requests.html#flags-parameter
There's actually a great Google API for this. It takes in a location and returns the timezone for that location. Should be simple enough to create a bash or python script to get the results for each address in a CSV file or database then save the timezone information.
https://developers.google.com/maps/documentation/timezone/start
Request Endpoint:
https://maps.googleapis.com/maps/api/timezone/json?location=38.908133,-77.047119&timestamp=1458000000&key=YOUR_API_KEY
Response:
{
"dstOffset" : 3600,
"rawOffset" : -18000,
"status" : "OK",
"timeZoneId" : "America/New_York",
"timeZoneName" : "Eastern Daylight Time"
}

Resources