kata

Fractures

You will receive a JSON string containing an array of records. The records represent fractures mapped from a planar, horizontal outcrop. Each record represents one fracture and looks like this:

{"survey": "DGPS", "coords": [65.371, 28.593, 130.629, 47.407], "is_open": true}

Notice that each fracture has the following attributes:

Considering only the fractures measured with DGPS, answer the following questions:

  1. How many open fractures are there?
  2. Of these open fractures, how many are strictly longer than 10 m?
  3. These longer, open fractures fall into two orientation clusters. What is the product of the number of fractures in the two clusters?

The data you get from requests is a str in JSON format. You can convert JSON into a Python data structure using the json built-in library. For example, json.loads('[1, 2, 3]') results in a Python list.

Example

Here is a small example dataset:

{"fractures": [{"survey": "DGPS", "coords": [ 65.371,  28.593, 130.629,  41.407], "is_open":  true},
               {"survey": "SRVY", "coords": [ 34.704, -14.876,  47.296,  -3.124], "is_open":  true},
               {"survey": "DGPS", "coords": [-57.088,  42.648, -48.912,  37.352], "is_open": false},
               {"survey": "DGPS", "coords": [-66.568, -70.693,  63.432, -69.307], "is_open":  true},
               {"survey": "DGPS", "coords": [-42.117,  60.92,  -39.215,  59.717], "is_open":  true},
               {"survey": "DGPS", "coords": [-87.201,  93.463, -88.799, -92.537], "is_open":  true},
               ],
 "meta_data": {"survey_date": "2013-06-29", "surveyor": "AcmeSurveying"},
}

You'll have many more fractures than this small example. Here's how we'd answer the questions for this example data set:

  1. In this dataset, there are 4 open fractures surveyed with 'DGPS'.
  2. There are 3 such fractures that are longer than 10 m.
  3. The product of fracture counts the two orientations is 2 × 1 = 2.