<jupyter_start><jupyter_text>Monthly means for MACA data for national parks<jupyter_code>maca = ee.ImageCollection('IDAHO_EPSCOR/MACAv2_METDATA_MONTHLY')
parks = ee.FeatureCollection('users/majo3748/conus_natl_parks')
n_park = parks.size().getInfo()
park_list = parks.toList(n_park)
scenarios = ['historical', 'rcp85', 'rcp45']
variables = ['pr', 'tasmax', 'tasmin', 'huss', 'rsds', 'was']<jupyter_output><empty_output><jupyter_text>Iterate over parks and scenarios, exporting park-wide means for each<jupyter_code>processes = list()
for scenario in scenarios:
  scenario_data = maca.filterMetadata('scenario', 'equals', scenario)
  
  for var in variables:
    climate_var = scenario_data.select(var).toBands()
    
    for p in range(n_park):
      feat = ee.Feature(park_list.get(p))
      
      mean_dict = climate_var.reduceRegion(
        reducer = ee.Reducer.mean(), 
        geometry = feat.geometry(),
        scale = 4000, 
        maxPixels = 1e9
      )

      out = batch.Export.table.toDrive(
        collection = ee.FeatureCollection([ee.Feature(None, mean_dict)]),
        description = '_'.join([feat.get('UNIT_CO').getInfo(), var, scenario]), 
        folder = 'maca-monthly'
      )
      processes.append(batch.Task.start(out))
# how many jobs did we submit?
len(processes)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13444108761329304, 'fraction_numerical': 0.011329305135951661, 'mean_word_length': 4.096153846153846, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '209082', 'license': 'MIT', 'n_tokens_mistral': 473, 'n_tokens_neox': 457, 'n_words': 85, 'path': 'maca-nps-monthly-means.ipynb', 'repo_name': 'mbjoseph/primers', 'size': '1324'}