I am interested in downloading "TropicalStorm" data for hurricanes with the highest "WindSpeed" occurring in the years 1990 through 2010. However, I am not sure of how to go about the third aspect of selecting data for a certain interval of dates.

The documentation page for EntityClass states that

Property values in implicitly defined entity classes may make use of Quantity (and intervals of Quantity) for dimensional values, DateObject for dates, TakeLargest and TakeSmallest for ordinal selections, and ContainsAll, ContainsExactly, ContainsAny, ContainsOnly, ContainsNone for entities. Lists of entities are interpreted as ContainsAll, while a single entity is interpreted as ContainsAny[{entity}].

For a number or Quantity, I know I could do this (example taken from documentation):

EntityList[EntityClass["Element", {"Density"->Quantity[Interval[{5, 8}], "Grams"/"Centimeters"^3]}]]


Is there a way I could use an analogous approach with DateObject instead of Quantity? Something like this is what I mean:

EntityList[EntityClass["TropicalStorm", {"Date" -> DateObject[Interval[{1990, 2010}]], "WindSpeed" -> TakeLargest[10]}]]


(Though this does not work of course.) If there is not a good way to do this with Interval, then what would be the best way to download data that falls within a certain range of dates?

I know I could download all of the data and then process it afterwards to filter out undesired dates, but that seems much less efficient and I feel there should be a better way.

I also considered using something along the lines of ContainsAny[DateRange[DateObject[{1990}], DateObject[{2010}]] to specify the interval of dates, but that seems far less efficient and even then I am not sure how to use ContainsAny in this context (see my other question Use of ContainsAny in EntityClass).

Thanks for the help!

• Seems like bug that what you have doesn't work. I would report to support@wolfram.com. Even the simple EntityList[ EntityClass["TropicalStorm", "StartDate" -> DateObject[{2007}]]] fails. – chuy Jan 25 '17 at 17:11

The implied EntityClass behavior with multiple predicates is to evaluate each predicate independently, and then apply Intersection to the results. You are probably expecting the predicates to be applied in sequence.

This means that to find the 10 highest wind speed storms from 1990 to 2010, you should probably find the storms that occur between 1990 to 2010, and then select the 10 storms with the highest wind speed.

Something like the following:

storms = EntityList @ EntityClass[
"TropicalStorm",
"EndDate"->Between[{DateObject[{1990,1,1}],DateObject[{2010,12,31}]}]
];

TakeLargestBy[
Last,
10
]


{{Unnamed,103.57mi/h},{Irene,92.0624mi/h},{Hunt,86.3085mi/h},{Pongsona,86.3085mi/h},{Grace,86.3085mi/h},{Florence,86.3085mi/h},{Floyd,80.5546mi/h},{Yuri,80.5546mi/h},{Unnamed,80.5546mi/h},{Dera,74.8007mi/h}}

Since the "WindSpeed" property is not "Cacheable" (it depends on time for current storms), using EntityValue will download the "WindSpeed" every time, so you might consider storing values yourself.

• I am curious as to why using "StartDate" rather than "EndDate" doesn't work.. – chuy Jan 25 '17 at 17:30
• Excellent point on the intersection vs. sequential application! Additionally, if one wanted to use Interval as was attempted in the OP, the following seems to work: "EndDate" -> Interval[{DateObject[{1990}], DateObject[{2010}]}], i.e. generate an Interval of DateObjects, rather than the other way around. – MarcoB Jan 25 '17 at 18:02
• Ah okay the Between operator or Interval of DateObjects were what I was looking for. Thanks! However, a question: you explain the "implied behavior" of EntityClass, but in the documentation page for EntityClass, even in the "Details" section, I do not see anything about the underlying behavior... how can I find the implied or underlying behavior for something in the Wolfram Language? – Grayscale Jan 26 '17 at 2:43
• The documentation for EntityClass states "An implicitly defined entity class represents all entities that fulfill all the specified restrictions on property values." – Carl Woll Jan 26 '17 at 2:59
• I was wrong about intersections for your example. Perhaps it would be more accurate to say that multiple TakeLargest/TakeSmallest queries would involve intersection, while single TakeLargest/TakeSmallest queries would involve the TakeXXX spec being used sequentially. – Carl Woll Jan 26 '17 at 4:01