<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Building a LAS file from scratch
Step1:  Step 1
Create some fake data, and make some of the values at the bottom NULL (numpy.nan). Note that of course every curve in a LAS file is recorded against a reference/index, either depth or time, so we create that array too.
Step2:  Step 2
Create an empty LASFile object and review its header section
Step3:  Let's add some information to the header
Step4:  Next, let's make a new item in the ~Parameters section for the operator. To do this we need to make a new HeaderItem
Step5:  And finally, add some free text to the ~Other section
Step6:  Step 3
Add the curves to the LAS file using the add_curve method
Step7:  Step 4
Now let's write out two files
Step8:  and let's see if that worked
<ASSISTANT_TASK:>
Python Code:
import lasio
import datetime
import numpy
import os
import matplotlib.pyplot as plt
%matplotlib inline
Explanation: Building a LAS file from scratch
End of explanation
depths = numpy.arange(10, 50, 0.5)
fake_curve = numpy.random.random(len(depths))
fake_curve[-10:] = numpy.nan   # Add some null values at the bottom
plt.plot(depths, fake_curve)
Explanation: Step 1
Create some fake data, and make some of the values at the bottom NULL (numpy.nan). Note that of course every curve in a LAS file is recorded against a reference/index, either depth or time, so we create that array too.
End of explanation
l = lasio.LASFile()
l.header
Explanation: Step 2
Create an empty LASFile object and review its header section
End of explanation
l.well.DATE = str(datetime.datetime.today())
Explanation: Let's add some information to the header: 
the date
the operator (in the Parameter section)
a description of the file in the Other section.
First, let's change the date.
End of explanation
l.params['ENGI'] = lasio.HeaderItem("ENGI", "", "kinverarity@hotmail.com", "Creator of this file...")
Explanation: Next, let's make a new item in the ~Parameters section for the operator. To do this we need to make a new HeaderItem:
End of explanation
l.other = "Example of how to create a LAS file from scratch using lasio"
Explanation: And finally, add some free text to the ~Other section:
End of explanation
l.add_curve('DEPT', depths, unit='m')
l.add_curve('FAKE_CURVE', fake_curve, descr='fake curve')
Explanation: Step 3
Add the curves to the LAS file using the add_curve method:
End of explanation
fn = "scratch_example_v2.las"
with open(fn, mode="w") as f: # Write LAS file to disk
    l.write(f)
Explanation: Step 4
Now let's write out two files: one according to the LAS file specification version 1.2, and one according to 2.0. Note that by default an empty LASFile object is version 2.0.
End of explanation
with open(fn, mode="r") as f: # Show the result... 
    print(f.read())
plt.plot(l['DEPT'], l['FAKE_CURVE'])
os.remove(fn)
Explanation: and let's see if that worked
End of explanation
<END_TASK>