uEMEP_set_subgrid_select_latlon_centre Subroutine

public subroutine uEMEP_set_subgrid_select_latlon_centre()

Arguments

None

Calls

proc~~uemep_set_subgrid_select_latlon_centre~~CallsGraph proc~uemep_set_subgrid_select_latlon_centre uEMEP_set_subgrid_select_latlon_centre proc~ll2laea LL2LAEA proc~uemep_set_subgrid_select_latlon_centre->proc~ll2laea proc~ll2ltm ll2ltm proc~uemep_set_subgrid_select_latlon_centre->proc~ll2ltm proc~ll2utm ll2utm proc~uemep_set_subgrid_select_latlon_centre->proc~ll2utm dcos dcos proc~ll2ltm->dcos dsin dsin proc~ll2ltm->dsin dtan dtan proc~ll2ltm->dtan proc~ll2utm->dcos proc~ll2utm->dsin proc~ll2utm->dtan

Called by

proc~~uemep_set_subgrid_select_latlon_centre~~CalledByGraph proc~uemep_set_subgrid_select_latlon_centre uEMEP_set_subgrid_select_latlon_centre program~uemep uEMEP program~uemep->proc~uemep_set_subgrid_select_latlon_centre

Source Code

    subroutine uEMEP_set_subgrid_select_latlon_centre()
        ! If specified using select_latlon_centre_domain_position_flag then this routines specifies
        ! the grid according to the lat lon position and the width and height
        ! This is intended to make life easier for users and to implement uEMEP in a more global context

        ! Local variables
        real :: x_out, y_out

        ! Find centre position in specified coordinates
        if (projection_type .eq. UTM_projection_index) then
            call ll2utm(1, utm_zone, select_lat_centre_position, select_lon_centre_position, y_out, x_out)
        else if (projection_type .eq. LTM_projection_index) then
            call ll2ltm(1, ltm_lon0, select_lat_centre_position, select_lon_centre_position, y_out, x_out)
        else if (projection_type .eq. LAEA_projection_index) then
            call LL2LAEA(x_out, y_out, select_lon_centre_position, select_lat_centre_position, projection_attributes)
        end if

        ! Snap to nearest 1 km
        x_out = floor(x_out/1000.0 + 0.5)*1000.0
        y_out = floor(y_out/1000.0 + 0.5)*1000.0

        ! Set max and min values
        subgrid_min(x_dim_index) = x_out - select_domain_width_EW_km*1000.0/2.0
        subgrid_min(y_dim_index) = y_out - select_domain_height_NS_km*1000.0/2.0
        subgrid_max(x_dim_index) = x_out + select_domain_width_EW_km*1000.0/2.0
        subgrid_max(y_dim_index) = y_out + select_domain_height_NS_km*1000.0/2.0

        write(unit_logfile,'(A,2f12.1)') 'Setting domain centre (lon,lat) to: ', select_lon_centre_position, select_lat_centre_position
        write(unit_logfile,'(A,2f12.1)') 'Setting min domain (x,y) to: ', subgrid_min(1:2)
        write(unit_logfile,'(A,2f12.1)') 'Setting max domain (x,y) to: ', subgrid_max(1:2)

        ! Reset the initial subgrid as well, needed for EMEP and receptor selection
        init_subgrid_min(x_dim_index) = subgrid_min(x_dim_index)
        init_subgrid_min(y_dim_index) = subgrid_min(y_dim_index)
        init_subgrid_max(x_dim_index) = subgrid_max(x_dim_index)
        init_subgrid_max(y_dim_index) = subgrid_max(y_dim_index)

    end subroutine uEMEP_set_subgrid_select_latlon_centre