Permalink
Browse files

tweaks to rake files

  • Loading branch information...
bentut committed Dec 13, 2012
1 parent 53542e7 commit 9df6bb9d308bdd740df745754e43d66f4db55c5d
View
@@ -682,7 +682,7 @@ def month_mult
def date_range
- return self.data.keys.sort if frequency == "day" or frequency == "week"
+ #return self.data.keys.sort
data_dates = self.data.keys.sort
start_date = Date.parse data_dates[0]
@@ -691,13 +691,24 @@ def date_range
dates = []
offset = 0
- month_multiplier = month_mult
- begin
- curr_date = start_date>>offset*month_multiplier
- dates.push(curr_date.to_s)
- offset += 1
- end while curr_date < end_date
+ if frequency == "day" or frequency == "week"
+ day_multiplier = frequency == "day" ? 1 : 7
+ begin
+ curr_date = start_date + offset * day_multiplier
+ dates.push(curr_date.to_s)
+ offset += 1
+ end while curr_date < end_date
+ else
+ month_multiplier = month_mult
+ begin
+ curr_date = start_date>>offset*month_multiplier
+ dates.push(curr_date.to_s)
+ offset += 1
+ end while curr_date < end_date
+ end
+
+
dates
end
@@ -721,7 +732,7 @@ def tsd_string
sci_data = {}
dps.each do |date_string, val|
- sci_data[date_string] = ("%.6E" % val).insert(-3,"00")
+ sci_data[date_string] = ("%.6E" % units_at(date_string)).insert(-3,"00")
end
View
@@ -1784,7 +1784,7 @@ task :bea_identities => :environment do
"YPC_R@HI.Q".ts_eval = %Q|"YPC@HI.Q".ts / "CPI@HON.Q".ts * 100|
#this is wrong
- "YPC@NBI.A".ts_eval = %Q|"YPC@HI.A".ts - "YPC@HON.A".ts|
+ #"YPC@NBI.A".ts_eval = %Q|"YPC@HI.A".ts - "YPC@HON.A".ts|
#A isn't really right either right. Q is wrong. Now A works and other thing is wrong
"SH_YPC@HON.A".ts_eval = %Q|"YPC@HON.A".ts / "YPC@HI.A".ts|
@@ -1850,16 +1850,23 @@ task :bea_identities => :environment do
end
end
- #YPC calculated above needs to get overwritte. Should maybe remove
- "YPC@NBI.A".ts_eval= %Q|"Y@NBI.A".ts / "NR@NBI.A".ts|
#YPC base series needs corrections
- ["YPC", "YDIV", "YNETR", "YOTLABPEN", "YOTLABSS", "YOTLAB", "YPCBEA", "YPC", "YPROPFA", "YPROPNF", "YPROP", "YRESADJ", "YSOCSECEM", "YSOCSECPR", "YSOCSEC", "YTRNSF", "YWAGE", "Y"].each do |pre|
+ ["YDIV", "YNETR", "YOTLABPEN", "YOTLABSS", "YOTLAB", "YPCBEA", "YPROPFA", "YPROPNF", "YPROP", "YRESADJ", "YSOCSECEM", "YSOCSECPR", "YSOCSEC", "YTRNSF", "YWAGE", "Y"].each do |pre|
("#{pre}@NBI.A".ts_eval= %Q|"#{pre}@HI.A".ts - "#{pre}@HON.A".ts|) rescue puts "NBI ERROR FORM #{pre}"
["HI", "HON", "MAU", "HAW", "KAU", "NBI"].each do |cnty|
("#{pre}_R@#{cnty}.A".ts_eval= %Q|"#{pre}@#{cnty}.A".ts / "CPI@HON.A".ts * 100|) rescue puts "_R ERROR FORM #{pre}_R@#{cnty}"
end
end
+
+ #YPC calculated above needs to get overwritte. Should maybe remove
+ "YPC@NBI.A".ts_eval= %Q|"Y@NBI.A".ts / "NR@NBI.A".ts|
+
+ ["YPC"].each do |pre|
+ ["HI", "HON", "MAU", "HAW", "KAU", "NBI"].each do |cnty|
+ ("#{pre}_R@#{cnty}.A".ts_eval= %Q|"#{pre}@#{cnty}.A".ts / "CPI@HON.A".ts * 100|) rescue puts "_R ERROR FORM #{pre}_R@#{cnty}"
+ end
+ end
# _R ERROR FORM YTRNSFOT_R@HI
# _R ERROR FORM YTRNSFUI_R@HI
@@ -1940,7 +1947,8 @@ task :bea_identities => :environment do
"FAMSIZE_TEMP@HI.A".ts_eval= %Q|"YMED@HI.A".ts / "YPC@HI.A".ts|
- "FAMSIZE_TEMP@HI.A".ts_eval= %Q|("FAMSIZE@HON.A".ts * ("FAMSIZE_TEMP@HI.A".ts / "FAMSIZE@HON.A".ts).average).trim("1990-01-01","1996-01-01")|
+ "FAMSIZE_TEMP@HI.A".ts_eval= %Q|("FAMSIZE@HON.A".ts * (("YMED@HI.A".ts / "YPC@HI.A".ts) / "FAMSIZE@HON.A".ts).average).trim("1990-01-01","1996-01-01")|
+
"FAMSIZE@HI.Q".ts_eval = %Q|"FAMSIZE_TEMP@HI.A".ts.pseudo_centered_spline_interpolation(:quarter)|
"FAMSIZE@HI.Q".ts_eval = %Q|"FAMSIZE@HI.Q".ts.extend_last_date_to_match("YPC@HI.Q")|
View
@@ -151,7 +151,11 @@ task :const_identities => :environment do
Series.load_all_series_from "/Volumes/UHEROwork/data/rawdata/Manual/hud_upd.xls"
Series.load_all_series_from "/Volumes/UHEROwork/data/rawdata/manual/HAWpermits.xls"
- ["KPPRVNS", "KPPRVRSDNS"].each do |s_name|
+ # ["KPPRVNS", "KPPRVRSDNS"].each do |s_name|
+ # "#{s_name}@HI.M".ts_eval= %Q|("#{s_name}@HAW.M".ts + "#{s_name}@MAU.M".ts + "#{s_name}@KAU.M".ts + "#{s_name}@HON.M".ts).trim("2012-04-01")|
+ # end
+
+ ["KPPRVRSDNS"].each do |s_name|
"#{s_name}@HI.M".ts_eval= %Q|("#{s_name}@HAW.M".ts + "#{s_name}@MAU.M".ts + "#{s_name}@KAU.M".ts + "#{s_name}@HON.M".ts).trim("2012-04-01")|
end
View
@@ -22,11 +22,11 @@ end
task :tsd_exports => :environment do
t = Time.now
path = "/Volumes/UHEROwork/data/BnkLists/"
- # [ "bea_a", "bls_a", "census_a", "jp_a", "misc_a", "tax_a", "tour_a", "us_a",
- # "bea_s", "bls_s",
- # "bea_q", "bls_q", "census_q", "jp_q", "misc_q", "tax_q", "tour_q", "us_q",
- # "bls_m", "jp_m", "misc_m", "tax_m", "tour_m", "us_m",
-[ "tour_w", "tour_d" ].each do |bank|
+ [ "bea_a", "bls_a", "census_a", "jp_a", "misc_a", "tax_a", "tour_a", "us_a",
+ "bea_s", "bls_s",
+ "bea_q", "bls_q", "census_q", "jp_q", "misc_q", "tax_q", "tour_q", "us_q",
+ "bls_m", "jp_m", "misc_m", "tax_m", "tour_m", "us_m",
+ "tour_w", "tour_d" ].each do |bank|
# ["bls_m"].each do |bank|
t = Time.now
frequency_code = bank.split("_")[1].upcase
Oops, something went wrong.

0 comments on commit 9df6bb9

Please sign in to comment.