Question: Hello, i am working with a CSV file that contains the date and corresponding precipitation. I would like to write the Julian day of year
Hello, i am working with a CSV file that contains the date and corresponding precipitation. I would like to write the Julian day of year (from 1-365) for each date. What i have so far is this:
import pandas as pd
import numpy as np
from pandas import read_csv
from obspy.core import UTCDateTime
data=pd.read_csv('script.csv')
date = np.array(data[['DATE']])
prcp = np.array(data[['PRCP']])
julday= []
for i in range(len(date)):
year= date[i][0].split('-')[0]
month= date[i][0].split('-')[1]
day= date[i][0].split('-')[2]
newdate= UTCDateTime(int(year), int(month), int(day))
julday.append(newdate.julday)
This is giving me values from 1-- 365, but it is repeated over and over again. I dont know if i am thinking about this problem correctly. Any help/advice?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
