Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy derivation of gtfgco2 #83

Closed
wants to merge 3 commits into from
Closed

Conversation

bouweandela
Copy link
Member

Partially address #42. Please check carefully if results are the same, because there are no unit tests and changes to the code are large.

@bouweandela bouweandela requested a review from ledm June 12, 2019 14:51
@mattiarighi mattiarighi added the preprocessor Related to the preprocessor label Jun 15, 2019
@mattiarighi
Copy link
Contributor

I tested this with HadGEM2-ES, but I get an error:

2019-06-18 14:10:31,501 UTC [9866] ERROR   Failed to run derive([<iris 'Cube' of surface_downward_mass_flux_of_carbon_dioxide_expressed_as_carbon / (kg m-2 s-1) (time: 48; latitude: 216; longitude: 360)>], {'short_name': 'gtfgco2', 'standard_name': '', 'long_name': 'Global Total Surface Downward CO2 Flux', 'units': 'kg s-1', 'fx_files': {'areacello': '/mnt/lustre02/work/bd0854/DATA/ESMValTool2/CMIP5_ETHZ/historical/fx/areacello/HadGEM2-ES/r0i0p0/areacello_fx_HadGEM2-ES_historical_r0i0p0.nc'}})
2019-06-18 14:10:31,542 UTC [9787] ERROR   Program terminated abnormally, see stack trace below for more information
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/mnt/lustre01/pf/b/b309057/SOFTWARE/miniconda3/envs/esmvaltool/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/_task.py", line 671, in _run_task
    output_files = task.run()
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/_task.py", line 227, in run
    self.output_files = self._run(input_files)
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/preprocessor/__init__.py", line 392, in _run
    product.apply(step, self.debug)
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/preprocessor/__init__.py", line 259, in apply
    self.cubes = preprocess(self.cubes, step, **self.settings[step])
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/preprocessor/__init__.py", line 201, in preprocess
    result.append(_run_preproc_function(function, items, settings))
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/preprocessor/__init__.py", line 187, in _run_preproc_function
    return function(items, **kwargs)
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/preprocessor/_derive/__init__.py", line 111, in derive
    cube = DerivedVariable().calculate(cubes)
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/preprocessor/_derive/gtfgco2.py", line 29, in calculate
    total_flux = (fgco2_cube * area_cube).collapsed(
  File "/mnt/lustre01/pf/b/b309057/SOFTWARE/miniconda3/envs/esmvaltool/lib/python3.7/site-packages/iris/analysis/maths.py", line 411, in multiply
    in bad_coord_grps}))
ValueError: This operation cannot be performed as there are differing coordinates (time, year, day_of_month, month_number, day_of_year) remaining which cannot be ignored.
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/_main.py", line 228, in run
    conf = main(args)
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/_main.py", line 156, in main
    process_recipe(recipe_file=recipe, config_user=cfg)
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/_main.py", line 206, in process_recipe
    recipe.run()
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/_recipe.py", line 1081, in run
    self.tasks, max_parallel_tasks=self._cfg['max_parallel_tasks'])
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/_task.py", line 596, in run_tasks
    _run_tasks_parallel(tasks, max_parallel_tasks)
  File "/mnt/lustre01/pf/b/b309057/ESMValTool/core/esmvalcore/_task.py", line 641, in _run_tasks_parallel
    task.output_files, updated_products = result.get()
  File "/mnt/lustre01/pf/b/b309057/SOFTWARE/miniconda3/envs/esmvaltool/lib/python3.7/multiprocessing/pool.py", line 657, in get
    raise self._value
ValueError: This operation cannot be performed as there are differing coordinates (time, year, day_of_month, month_number, day_of_year) remaining which cannot be ignored.
2019-06-18 14:10:31,549 UTC [9787] INFO    If you suspect this is a bug or need help, please open an issue on https://github.com/ESMValGroup/ESMValTool/issues and attach the run/recipe_*.yml and run/main_log_debug.txt files from the output directory.

@bouweandela
Copy link
Member Author

bouweandela commented Nov 8, 2019

I think this derivation function is no longer needed, as this derived variable can be computed from fgco2 using the preprocessor:

preprocessors:
  global_total:
    area_statistics:
      operator: sum
      fx_files: [areacello]

@ledm Can you comment on this?

@bouweandela bouweandela mentioned this pull request Jan 3, 2020
4 tasks
@bouweandela bouweandela closed this Jan 3, 2020
@bouweandela bouweandela deleted the lazy_gtfgco2_derivation branch January 3, 2020 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preprocessor Related to the preprocessor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants