<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Reading CTD data with PySeabird
Author
Step1:  Let's first download an example file with some CTD data
Step2:  The profile dPIRX003.cnv.OK was loaded with the default rule cnv.yaml
Step3:  We have latitude in the header, and pressure in the data.
<ASSISTANT_TASK:>
Python Code:
%matplotlib inline
from seabird.cnv import fCNV
from gsw import z_from_p
Explanation: Reading CTD data with PySeabird
Author: Guilherme Castelão
pySeabird is a package to parse/load CTD data files. It should be an easy task but the problem is that the format have been changing along the time. Work with multiple ships/cruises data requires first to understand each file, to normalize it into a common format for only than start your analysis. That can still be done with few general regular expression rules, but I would rather use strict rules. If I'm loading hundreds or thousands of profiles, I want to be sure that no mistake passed by. I rather ignore a file in doubt and warn it, than belive that it was loaded right and be part of my analysis.
With that in mind, I wrote this package with the ability to load multiple rules, so new rules can be added without change the main engine.
For more information, check the documentatio
End of explanation
!wget https://raw.githubusercontent.com/castelao/seabird/master/sampledata/CTD/dPIRX003.cnv
profile = fCNV('dPIRX003.cnv')
Explanation: Let's first download an example file with some CTD data
End of explanation
print("Header: %s" % profile.attributes.keys())
print("Data: %s" % profile.keys())
Explanation: The profile dPIRX003.cnv.OK was loaded with the default rule cnv.yaml
End of explanation
z = z_from_p(profile['PRES'], profile.attributes['LATITUDE'])
from matplotlib import pyplot as plt
plt.plot(profile['TEMP'], z,'b')
plt.plot(profile['TEMP2'], z,'g')
plt.xlabel('temperature')
plt.ylabel('depth')
plt.title(profile.attributes['filename'])
Explanation: We have latitude in the header, and pressure in the data.
End of explanation
<END_TASK>