public static function fromArray(&$p)
 {
     $instruments = array();
     $observations = array();
     $piers = array();
     if (isset($p['instruments'])) {
         foreach ($p['instruments'] as $instrument) {
             $instruments[] = Instrument::fromArray($instrument);
         }
     }
     if (isset($p['observations'])) {
         foreach ($p['observations'] as $observation) {
             $observations[] = Observation::fromArray($observation);
         }
     }
     if (isset($p['piers'])) {
         foreach ($p['piers'] as $pier) {
             $piers[] = Pier::fromArray($pier);
         }
     }
     return new ObservatoryDetail($p['id'], $p['code'], $p['name'], $p['default_pier_id'], $p['location'], $p['latitude'], $p['longitude'], $p['geomagnetic_latitude'], $p['geomagnetic_longitude'], $p['elevation'], $p['orientation'], $instruments, $observations, $piers);
 }