SCALE-RM
Data Types | Functions/Subroutines | Variables
scale_mapprojection Module Reference

module Map projection More...

Data Types

interface  lonlat2xy_s
 
interface  mapfactor_s
 
interface  rotcoef_s
 

Functions/Subroutines

subroutine, public mapprojection_setup (DOMAIN_CENTER_X, DOMAIN_CENTER_Y)
 Setup. More...
 
subroutine mapprojection_xy2lonlat_0d (x, y, lon, lat)
 (x,y) -> (lon,lat) More...
 
subroutine, public mapprojection_mapfactor (IA, IS, IE, JA, JS, JE, lat, m1, m2)
 (x,y) -> (lon,lat) More...
 
subroutine, public mapprojection_rotcoef (IA, IS, IE, JA, JS, JE, lon, lat, rotc)
 u(lat,lon) = cos u(x,y) - sin v(x,y) v(lat,lon) = sin u(x,y) + cos v(x,y) More...
 
subroutine, public mapprojection_get_attributes (mapping, false_easting, false_northing, longitude_of_central_meridian, longitude_of_projection_origin, latitude_of_projection_origin, straight_vertical_longitude_from_pole, standard_parallel)
 Get mapping attributes. More...
 

Variables

real(rp), public mapprojection_basepoint_lon = 135.221_RP
 
real(rp), public mapprojection_basepoint_lat = 34.653_RP
 
procedure(xy2lonlat_s), pointer xy2lonlat => NULL()
 

Detailed Description

module Map projection

Description
Map projection module
Author
Team SCALE
NAMELIST
  • PARAM_MAPPROJECTION
    nametypedefault valuecomment
    MAPPROJECTION_BASEPOINT_LON real(RP) 135.221_RP position of base point (domain center) in real world [deg]
    MAPPROJECTION_BASEPOINT_LAT real(RP) 34.653_RP position of base point (domain center) in real world [deg]
    MAPPROJECTION_BASEPOINT_X real(DP) position of base point in the model [m]
    MAPPROJECTION_BASEPOINT_Y real(DP) position of base point in the model [m]
    MAPPROJECTION_TYPE character(len=H_SHORT) 'NONE' map projection type
    MAPPROJECTION_ROTATION real(DP) 0.0_DP rotation factor
    MAPPROJECTION_LC_LAT1 real(DP) 30.0_DP standard latitude1 for L.C. projection [deg]
    MAPPROJECTION_LC_LAT2 real(DP) 60.0_DP standard latitude2 for L.C. projection [deg]
    MAPPROJECTION_PS_LAT real(DP) standard latitude1 for P.S. projection [deg]
    MAPPROJECTION_M_LAT real(DP) 0.0_DP standard latitude1 for Mer. projection [deg]
    MAPPROJECTION_EC_LAT real(DP) 0.0_DP standard latitude1 for E.C. projection [deg]

History Output
No history output

Function/Subroutine Documentation

◆ mapprojection_setup()

subroutine, public scale_mapprojection::mapprojection_setup ( real(rp), intent(in)  DOMAIN_CENTER_X,
real(rp), intent(in)  DOMAIN_CENTER_Y 
)

Setup.

Parameters
[in]domain_center_xcenter position of global domain [m]: x
[in]domain_center_ycenter position of global domain [m]: y

Definition at line 167 of file scale_mapprojection.F90.

References scale_const::const_d2r, scale_const::const_pi, scale_const::const_radius, scale_const::const_undef, scale_io::io_fid_conf, mapprojection_basepoint_lat, mapprojection_basepoint_lon, scale_prc::prc_abort(), and xy2lonlat.

Referenced by scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_setup().

167  use scale_prc, only: &
168  prc_abort
169  use scale_const, only: &
170  undef => const_undef, &
171  pi_rp => const_pi, &
172  d2r_rp => const_d2r, &
173  radius_rp => const_radius
174  implicit none
175 
176  real(RP), intent(in) :: domain_center_x
177  real(RP), intent(in) :: domain_center_y
178 
179  namelist / param_mapprojection / &
180  mapprojection_basepoint_lon, &
181  mapprojection_basepoint_lat, &
182  mapprojection_basepoint_x, &
183  mapprojection_basepoint_y, &
184  mapprojection_type, &
185  mapprojection_rotation, &
186  mapprojection_lc_lat1, &
187  mapprojection_lc_lat2, &
188  mapprojection_ps_lat, &
189  mapprojection_m_lat, &
190  mapprojection_ec_lat
191 
192  integer :: ierr
193  !---------------------------------------------------------------------------
194 
195  log_newline
196  log_info("MAPPROJECTION_setup",*) 'Setup'
197 
198  pi = real(pi_rp, kind=dp)
199  d2r = real(d2r_rp, kind=dp)
200  radius = real(radius_rp, kind=dp)
201 
202  mapprojection_basepoint_x = undef
203  mapprojection_basepoint_y = undef
204  mapprojection_ps_lat = undef
205 
206  mapprojection_basepoint_x = domain_center_x
207  mapprojection_basepoint_y = domain_center_y
208 
209  !--- read namelist
210  rewind(io_fid_conf)
211  read(io_fid_conf,nml=param_mapprojection,iostat=ierr)
212 
213  if( ierr < 0 ) then !--- missing
214  log_info("MAPPROJECTION_setup",*) 'Not found namelist. Default used.'
215  elseif( ierr > 0 ) then !--- fatal error
216  log_error("MAPPROJECTION_setup",*) 'Not appropriate names in namelist PARAM_MAPPROJECTION. Check!'
217  call prc_abort
218  endif
219  log_nml(param_mapprojection)
220 
221  log_newline
222  log_info("MAPPROJECTION_setup",*) 'Map projection information'
223  log_info_cont('(1x,A,F15.3)') 'Basepoint(x) [m] : ', mapprojection_basepoint_x
224  log_info_cont('(1x,A,F15.3)') 'Basepoint(y) [m] : ', mapprojection_basepoint_y
225  log_info_cont(*) 'Map projection type : ', trim(mapprojection_type)
226 
227  mapprojection_mapping = ""
228  mapprojection_false_easting = undef
229  mapprojection_false_northing = undef
230  mapprojection_longitude_of_central_meridian = undef
231  mapprojection_longitude_of_projection_origin = undef
232  mapprojection_latitude_of_projection_origin = undef
233  mapprojection_straight_vertical_longitude_from_pole = undef
234  mapprojection_standard_parallel(:) = undef
235 
236  if( mapprojection_ps_lat == undef ) mapprojection_ps_lat = mapprojection_basepoint_lat
237 
238  select case(trim(mapprojection_type))
239  case('NONE')
240  log_info_cont(*) '=> NO map projection'
241  call mapprojection_none_setup
242  xy2lonlat => mapprojection_none_xy2lonlat
243  lonlat2xy => mapprojection_none_lonlat2xy
244  mapfactor => mapprojection_none_mapfactor
245  rotcoef => mapprojection_none_rotcoef
246  case('LC')
247  log_info_cont(*) '=> Lambert Conformal projection'
248  call mapprojection_lambertconformal_setup
249  xy2lonlat => mapprojection_lambertconformal_xy2lonlat
250  lonlat2xy => mapprojection_lambertconformal_lonlat2xy
251  mapfactor => mapprojection_lambertconformal_mapfactor
252  rotcoef => mapprojection_lambertconformal_rotcoef
253  case('PS')
254  log_info_cont(*) '=> Polar Stereographic projection'
255  call mapprojection_polarstereographic_setup
256  xy2lonlat => mapprojection_polarstereographic_xy2lonlat
257  lonlat2xy => mapprojection_polarstereographic_lonlat2xy
258  mapfactor => mapprojection_polarstereographic_mapfactor
259  rotcoef => mapprojection_polarstereographic_rotcoef
260  case('MER')
261  log_info_cont(*) '=> Mercator projection'
262  call mapprojection_mercator_setup
263  xy2lonlat => mapprojection_mercator_xy2lonlat
264  lonlat2xy => mapprojection_mercator_lonlat2xy
265  mapfactor => mapprojection_mercator_mapfactor
266  rotcoef => mapprojection_mercator_rotcoef
267  case('EC')
268  log_info_cont(*) '=> Equidistant Cylindrical projection'
269  call mapprojection_equidistantcylindrical_setup
270  xy2lonlat => mapprojection_equidistantcylindrical_xy2lonlat
271  lonlat2xy => mapprojection_equidistantcylindrical_lonlat2xy
272  mapfactor => mapprojection_equidistantcylindrical_mapfactor
273  rotcoef => mapprojection_equidistantcylindrical_rotcoef
274  case default
275  log_error("MAPPROJECTION_setup",*) 'Unsupported MAPPROJECTION_type. STOP'
276  call prc_abort
277  endselect
278 
279  mapprojection_rotation = mapprojection_rotation * d2r
280  mapprojection_rot_fact_sin = sin(mapprojection_rotation)
281  mapprojection_rot_fact_cos = cos(mapprojection_rotation)
282 
283  return
real(rp), public const_radius
radius of the planet [m]
Definition: scale_const.F90:44
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:55
real(rp), public const_d2r
degree to radian
Definition: scale_const.F90:32
real(rp), public const_undef
Definition: scale_const.F90:41
module PROCESS
Definition: scale_prc.F90:11
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:338
module CONSTANT
Definition: scale_const.F90:11
real(rp), public const_pi
pi
Definition: scale_const.F90:31
integer, parameter, public dp
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mapprojection_xy2lonlat_0d()

subroutine scale_mapprojection::mapprojection_xy2lonlat_0d ( real(rp), intent(in)  x,
real(rp), intent(in)  y,
real(rp), intent(out)  lon,
real(rp), intent(out)  lat 
)

(x,y) -> (lon,lat)

Definition at line 291 of file scale_mapprojection.F90.

References xy2lonlat.

291  implicit none
292  real(RP), intent(in) :: x
293  real(RP), intent(in) :: y
294  real(RP), intent(out) :: lon ! [rad]
295  real(RP), intent(out) :: lat ! [rad]
296 
297  real(DP) :: xx, yy
298  !---------------------------------------------------------------------------
299 
300  xx = mapprojection_basepoint_x &
301  + ( x - mapprojection_basepoint_x ) * mapprojection_rot_fact_cos &
302  - ( y - mapprojection_basepoint_y ) * mapprojection_rot_fact_sin
303  yy = mapprojection_basepoint_y &
304  + ( y - mapprojection_basepoint_y ) * mapprojection_rot_fact_cos &
305  + ( x - mapprojection_basepoint_x ) * mapprojection_rot_fact_sin
306 
307  call xy2lonlat( xx, yy, lon, lat )
308 
309  return

◆ mapprojection_mapfactor()

subroutine, public scale_mapprojection::mapprojection_mapfactor ( integer, intent(in)  IA,
integer, intent(in)  IS,
integer, intent(in)  IE,
integer, intent(in)  JA,
integer, intent(in)  JS,
integer, intent(in)  JE,
real(rp), dimension(ia,ja), intent(in)  lat,
real(rp), dimension (ia,ja), intent(out)  m1,
real(rp), dimension (ia,ja), intent(out)  m2 
)

(x,y) -> (lon,lat)

Definition at line 397 of file scale_mapprojection.F90.

Referenced by scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_setup().

397  implicit none
398  integer, intent(in) :: ia, is, ie
399  integer, intent(in) :: ja, js, je
400 
401  real(RP), intent(in) :: lat(ia,ja) ! [rad]
402  real(RP), intent(out) :: m1 (ia,ja)
403  real(RP), intent(out) :: m2 (ia,ja)
404 
405  !real(RP) :: mm1, mm2
406  integer :: i, j
407  !---------------------------------------------------------------------------
408 
409  !$omp parallel do
410  do j = js, je
411  do i = is, ie
412  call mapfactor( lat(i,j), m1(i,j), m2(i,j) )
413 !!$ call mapfactor( lat(i,j), mm1, mm2 )
414 !!$ m1(i,j) = sqrt( (MAPPROJECTION_rot_fact_cos * mm1)**2 + (MAPPROJECTION_rot_fact_sin * mm2)**2 )
415 !!$ m2(i,j) = sqrt( (MAPPROJECTION_rot_fact_cos * mm2)**2 + (MAPPROJECTION_rot_fact_sin * mm1)**2 )
416  end do
417  end do
418 
419  return
integer, public ia
of whole cells: x, local, with HALO
integer, public ja
of whole cells: y, local, with HALO
integer, public is
start point of inner domain: x, local
integer, public ie
end point of inner domain: x, local
integer, public je
end point of inner domain: y, local
integer, public js
start point of inner domain: y, local
Here is the caller graph for this function:

◆ mapprojection_rotcoef()

subroutine, public scale_mapprojection::mapprojection_rotcoef ( integer, intent(in)  IA,
integer, intent(in)  IS,
integer, intent(in)  IE,
integer, intent(in)  JA,
integer, intent(in)  JS,
integer, intent(in)  JE,
real(rp), dimension(ia,ja), intent(in)  lon,
real(rp), dimension(ia,ja), intent(in)  lat,
real(rp), dimension(ia,ja,2), intent(out)  rotc 
)

u(lat,lon) = cos u(x,y) - sin v(x,y) v(lat,lon) = sin u(x,y) + cos v(x,y)

Parameters
[out]rotcrotc(:,:,1)->cos, rotc(:,:,2)->sin

Definition at line 429 of file scale_mapprojection.F90.

Referenced by scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_rotcoef().

429  implicit none
430  integer, intent(in) :: ia, is, ie
431  integer, intent(in) :: ja, js, je
432 
433  real(RP), intent(in) :: lon(ia,ja) ! [rad]
434  real(RP), intent(in) :: lat(ia,ja) ! [rad]
435  real(RP), intent(out) :: rotc(ia,ja,2)
436 
437  integer :: i, j
438  !---------------------------------------------------------------------------
439 
440  !$omp parallel do
441  do j = js, je
442  do i = is, ie
443  call rotcoef( lon(i,j), lat(i,j), rotc(i,j,1), rotc(i,j,2) )
444  end do
445  end do
446 
447  return
integer, public ia
of whole cells: x, local, with HALO
integer, public ja
of whole cells: y, local, with HALO
integer, public is
start point of inner domain: x, local
integer, public ie
end point of inner domain: x, local
integer, public je
end point of inner domain: y, local
integer, public js
start point of inner domain: y, local
Here is the caller graph for this function:

◆ mapprojection_get_attributes()

subroutine, public scale_mapprojection::mapprojection_get_attributes ( character(len=*), intent(out)  mapping,
real(dp), intent(out), optional  false_easting,
real(dp), intent(out), optional  false_northing,
real(dp), intent(out), optional  longitude_of_central_meridian,
real(dp), intent(out), optional  longitude_of_projection_origin,
real(dp), intent(out), optional  latitude_of_projection_origin,
real(dp), intent(out), optional  straight_vertical_longitude_from_pole,
real(dp), dimension(2), intent(out), optional  standard_parallel 
)

Get mapping attributes.

Definition at line 461 of file scale_mapprojection.F90.

References mapprojection_basepoint_lat, mapprojection_basepoint_lon, and scale_prc::prc_abort().

Referenced by scale_file_cartesc::file_cartesc_def_var(), scale_file_history_cartesc::file_history_cartesc_set_pres(), scale_file_history_cartesc::file_history_cartesc_truncate_3d(), and scale_file_cartesc::set_dimension_informations().

461  implicit none
462 
463  character(len=*), intent(out) :: mapping
464 
465  real(DP), intent(out), optional :: false_easting
466  real(DP), intent(out), optional :: false_northing
467  real(DP), intent(out), optional :: longitude_of_central_meridian
468  real(DP), intent(out), optional :: longitude_of_projection_origin
469  real(DP), intent(out), optional :: latitude_of_projection_origin
470  real(DP), intent(out), optional :: straight_vertical_longitude_from_pole
471  real(DP), intent(out), optional :: standard_parallel(2)
472  !---------------------------------------------------------------------------
473 
474  mapping = mapprojection_mapping
475 
476  if ( present(false_easting) ) &
477  false_easting = mapprojection_false_easting
478  if ( present(false_northing) ) &
479  false_northing = mapprojection_false_northing
480  if ( present(longitude_of_central_meridian) ) &
481  longitude_of_central_meridian = mapprojection_longitude_of_central_meridian
482  if ( present(longitude_of_projection_origin) ) &
483  longitude_of_projection_origin = mapprojection_longitude_of_projection_origin
484  if ( present(latitude_of_projection_origin) ) &
485  latitude_of_projection_origin = mapprojection_latitude_of_projection_origin
486  if ( present(straight_vertical_longitude_from_pole) ) &
487  straight_vertical_longitude_from_pole = mapprojection_straight_vertical_longitude_from_pole
488  if ( present(standard_parallel) ) &
489  standard_parallel(:) = mapprojection_standard_parallel(:)
490 
491  return
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ mapprojection_basepoint_lon

real(rp), public scale_mapprojection::mapprojection_basepoint_lon = 135.221_RP

Definition at line 46 of file scale_mapprojection.F90.

Referenced by scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_update_z(), mapprojection_get_attributes(), mapprojection_setup(), and mod_urban_driver::urban_driver_calc_tendency().

46  real(RP), public :: mapprojection_basepoint_lon = 135.221_rp ! position of base point (domain center) in real world [deg]

◆ mapprojection_basepoint_lat

real(rp), public scale_mapprojection::mapprojection_basepoint_lat = 34.653_RP

Definition at line 47 of file scale_mapprojection.F90.

Referenced by scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_update_z(), mapprojection_get_attributes(), mapprojection_setup(), and mod_urban_driver::urban_driver_calc_tendency().

47  real(RP), public :: mapprojection_basepoint_lat = 34.653_rp ! position of base point (domain center) in real world [deg]

◆ xy2lonlat

procedure(xy2lonlat_s), pointer scale_mapprojection::xy2lonlat => NULL()

Definition at line 157 of file scale_mapprojection.F90.

Referenced by mapprojection_setup(), and mapprojection_xy2lonlat_0d().

157  procedure(xy2lonlat_s), pointer :: xy2lonlat => null()