I work with database sis-hydrology-variables-derived-projections. When I try to use ct.cdsplot.geomap (I'm trying to apply a calculate trend application) a deprecation warning: 'The tool ct.cdsplot.geomap has been deprecated' occure. Since in the cordex data a rotated grid is used, maybe the coordinates will be needed to specify. And how can we do it?

2 Comments

  1. Hi Inna, can you share the workflow you are running, please?

    Thanks,

    Kevin

  2. Dear Kevin, thank for your response. I'm sharing my script. Now it turned out that a function 'geomap' is no longer used, but my issue haven't been adressed. Because now a console message is 'Data does not contain latitude and longitude coordinates so cannot use dynamic_plot_extent'

    I'm new to the CDS toolbox and Python. And all examples in the Tutorials show how to work with ERA5 data which have a regular latitude-longitude grid. And in the calculate trend application that I try to change I use the Cordex data with the rotate grid. Monthly mean and trends are calculated, I checked. And I found information on the Cordex rotate grid (RotPole 198.0, 39.25; TLC 331.79, 21.67; xn=106 yn=103, but I don't know how I can apply it. And I don't know what projection I need to specify.

    It is a new script below


    import cdstoolbox as ct

    # Configuration dictionary for the map customisation
    MAP_CONFIG = {
    # Customisation of the Magics contour plot
    "contour": {
    'legend' : "on",
    'contour_shade' : "on",
    'contour_shade_technique' : "grid_shading",
    'contour_shade_colour_method' : "palette",
    'contour_shade_palette_name' : "eccharts_blue_red3_10"
    }
    }

    layout = {
    'output_align': 'bottom'
    }

    extent = {
    'domain': 'europe'
    }

    projection = {
    'Europe': {
    'subpage_map_projection': 'polar_stereographic',
    'subpage_map_area_definition_polar': "centre",
    'subpage_map_scale': 40e6
    }
    }

    @ct.application(title='Calculate trends', layout=layout)
    @ct.input.dropdown('region', label='Region', values=[ 'Europe'])
    @ct.output.figure()
    @ct.output.figure()

    def trend_app(region):

    """
    Application main steps:

    - retrieve a variable over a defined time range
    - compute the monthly mean
    - select a region
    - compute the linear trend in time for each gridpoint in that region
    - plot trends and their standard errors on two separate maps
    """

    data = ct.catalogue.retrieve(
    'sis-hydrology-variables-derived-projections',
    {
    'product_type': 'essential_climate_variables',
    'variable': 'river_discharge',
    'variable_type': 'absolute_values',
    'time_aggregation': 'daily',
    'experiment': 'historical',
    'hydrological_model': 'e_hypecatch_m00',
    'rcm': 'cclm4_8_17',
    'gcm': 'ec_earth',
    'ensemble_member': 'r12i1p1',
    'period': '2001_2005',
    'domain': 'europe',
    'horizontal_resolution': '0_11_degree_x_0_11_degree'
    }
    )

    data_mean = ct.climate.monthly_mean(data)

    a, b, a_std, b_std = ct.stats.trend(
    data_mean, slope_units='m3 s-1 year-1')

    # Set the projection in the map configuration dictionary
    MAP_CONFIG['projection'] = projection[region]

    # Create a Magics map with a custom configuration (MAP_CONFIG) and title
    fig_b = ct.map.plot(
    b,
    title = 'River discharge trend (m3 s-1 year-1)',
    **MAP_CONFIG
    )
    # To learn how to create customised Magics map consult the advanced How to guide: https://cds.climate.copernicus.eu/toolbox/doc/how-to/22_how_to_make_a_map_with_magics_part2/22_how_to_make_a_map_with_magics_part2.html

    # Create a Magics map with a custom configuration (MAP_CONFIG) and title
    fig_b_std = ct.map.plot(
    b_std,
    title='River discharge trend standard deviation (m3 s-1 year-1)',
    **MAP_CONFIG
    )
    return fig_b, fig_b_std