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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!