ariesteam / aries

http://www.ariesonline.org
GNU General Public License v3.0
6 stars 1 forks source link

last CA carbon issue #26

Closed kbagstad closed 12 years ago

kbagstad commented 12 years ago

@lambdatronic

kbagstad commented 12 years ago

OK, so the CA carbon models work fine, but with one problem related to the stupid San Joaquin hack. When running the sink models, I get things looking great when I just run: model -o carbsocal.nc core.models.carbon-ca/sink core.contexts.beta/ca_mark_watershed256

When I run: model -o carbsj2107.nc core.models.carbon-ca/sink-sj core.contexts.beta/san_joaquin512

things also look good, except the system isn't properly adding vegetation-c-storage-sj and soil-carbon-storage-sj - I'm sure there's a syntax error in there somewhere that's invisible to me. The model immediately below works well for Orange County but then the hacked San Joaquin model below that doesn't properly sum veg & soil C storage.

(defmodel vegetation-soil-storage VegetationAndSoilCarbonStorage (measurement VegetationAndSoilCarbonStorage "t/ha*year" :context [vegetation-carbon-storage soil-carbon-storage] :state #(+ (if (nil? (:vegetation-c-storage %)) 0.0 (.getMean (:vegetation-c-storage %))) (if (nil? (:soil-c-storage %)) 0.0 (.getMean (:soil-c-storage %))))))

(defmodel vegetation-soil-storage-sj VegetationAndSoilCarbonStorage (measurement VegetationAndSoilCarbonStorage "t/ha*year" :context [vegetation-carbon-storage-sj soil-carbon-storage-sj] :state #(+ (if (nil? (:vegetation-c-storage-sj %)) 0.0 (.getMean (:vegetation-c-storage-sj %))) (if (nil? (:soil-c-storage-sj %)) 0.0 (.getMean (:soil-c-storage-sj %))))))