ESMValGroup / ESMValCore

ESMValCore: A community tool for pre-processing data from Earth system models in CMIP and running analysis scripts.
https://www.esmvaltool.org
Apache License 2.0
42 stars 38 forks source link

Extract odd-shaped (irregular) regions #44

Closed LisaBock closed 5 years ago

LisaBock commented 5 years ago

I would like to extract regions in the preprocessor of the ESMValTool which are not rectangular but as they are defined in the IPCC AR5 or AR6. For example to create the panels for a figure like this:

image

Is there a possibility to include this in the preprocessor functions?

At the moment I do not have the specific region definitions but I could share them when I received them.

valeriupredoi commented 5 years ago

@LisaBock it is very important from the implementation point of view to know which file format your regions are stored in - netCDF/Natural Earth/txt etc and what are the actual parameters of the region ie how it is defined in the file: like a mask of 0s and 1s, like a percentage that we apply a threshold on etc. Without this information I can not implement anything just yet. Cheers!

ledm commented 5 years ago

With regards to the Natural Earth Shapefiles, I can't see anything that names specific marine regions. The closest dataset I can find is the marine indicators, but I suspect that this is simply the national sea boundaries at 200 nautical miles.

I think that the best way to define the oceans right now would be to regrid CMIP models to a standard resolution in the preprocessor, then use an older regional definition mask file in the diagnostic. Do we have a definition file anywhere?

valeriupredoi commented 5 years ago

sftof is used for seas/oceans selection, that is available for most models, for the ones that dont have it we currently use Natural Earth low-res oceans shapefiles; the seas/oceans are not a problem - the problem is continents (and Russia? from the figure above) - we can use shapefiles for those as well but I thought @LisaBock already has a set of region-defining files at hand

mattiarighi commented 5 years ago

I think @LisaBock simply needs to extract regions which are not rectangular, but more generally quadrilateral.

No shapefiles should be required here, but only the possibility of specifying the coordinates of the four (or more) vertices which define the region.

LisaBock commented 5 years ago

Indeed, for the continental regions it should look like this (polygons with four or five corners):

image

But for the most diagnostics I would need a combination of this subregions.

And for the oceanic regions, I do not know if they are polygons. I asked already for the definitions but have not received them yet.

bouweandela commented 5 years ago

We already have the preprocessor function extract_region which is able to extract rectangular regions, so I think that should be able to extract most regions.

We also have a recipe that extracts regions based on shapefiles, recipe_shapeselect.yml. This could be used for the more complicated shapes, you will just need to define the shapefiles. You can then run this diagnostic before your own diagnostic, using the ancestors key in the recipe.

valeriupredoi commented 5 years ago

This would still be useftl in the preproc tho, to shrink the data and speed up the other preproc steps that follow. I agree we can use the shp extractor functionality we already have - Lisa, any chance you can define these regions for me in terms of lat-lon points? Then I can add a shp constructor function and use the shp masking we already have

Dr Valeriu Predoi. Computational scientist NCAS-CMS University of Reading Department of Meteorology Reading RG6 6BB United Kingdom

On Fri, 8 Mar 2019, 10:14 Bouwe Andela, notifications@github.com wrote:

We already have the preprocessor function extract_region https://esmvaltool.readthedocs.io/en/version2_development/codedoc2/esmvaltool.preprocessor.html#esmvaltool.preprocessor.extract_region which is able to extract rectangular regions, so I think that should be able to extract most regions.

We also have a recipe that extracts regions based on shapefiles, recipe_shapeselect.yml https://github.com/ESMValGroup/ESMValTool/blob/version2_development/esmvaltool/recipes/recipe_shapeselect.yml. This could be used for the more complicated shapes, you will just need to define the shapefiles. You can then run this diagnostic before your own diagnostic, using the ancestors key in the recipe.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ESMValGroup/ESMValTool/issues/943#issuecomment-470877029, or mute the thread https://github.com/notifications/unsubscribe-auth/AbpCo1cyZo8bSLRBcL-pRXzDoL4XS2Afks5vUjf3gaJpZM4bjNIj .

valeriupredoi commented 5 years ago

actually here's how I see a least-effort/maximum-outcome path to solve this:

what say you @LisaBock

LisaBock commented 5 years ago

Okay, I will try it like this. Thanks!

(Just for clarification @valeriupredoi: you mean extract_region instead of select_region, don't you? Or is this a function I do not know?)

valeriupredoi commented 5 years ago

yes that one sorry, I am starting to pull function names out my arse :grin:

valeriupredoi commented 5 years ago

hi @LisaBock - is this been done (by you) or you need any help implementing it? :beer:

mattiarighi commented 5 years ago

@LisaBock is this solved? If yes, please close.

valeriupredoi commented 5 years ago

closing since it looks to be solved, please re-open if need be :beer: