Last active
April 6, 2020 20:50
-
-
Save MiCurry/d32539c1bfaff58b34410d0a4a1d4cba to your computer and use it in GitHub Desktop.
mpas_init_atm_core.F for mpas_parse_geoindex.F
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Boolean | |
# | |
signed=NO | |
# | |
# Integer | |
# | |
category_max=13 | |
category_min = 1 | |
filename_digits=5 | |
iswater=14 | |
isice = 24 | |
islake=28 | |
isoilwater = 14 | |
isurban=1 | |
tile_x = 120 | |
tile_y = 720 | |
tile_z = 55 | |
tile_z = 10 | |
tile_z_start=1 | |
tile_z_end=24 | |
nothinghere=Nothing | |
wordsize=4 | |
blarhblahrblahr = 42 | |
badbad = 33 | |
dx = 0.0833333 | |
dy=0.008333333333 | |
known_lat = 0.0041 | |
known_lon = 0.004166667 | |
missing_value=0.0 | |
known_x=1.0 | |
known_y=1.0 | |
scale_factor=0.0001 | |
stdlon = 42.31459 | |
truelat1 = 42.0 | |
truelat2 = 100.0 | |
# | |
# Strings | |
# | |
description="14-category slope index" | |
ENDIAN=big | |
mminlu="USGS" | |
projection=regular_ll | |
ROW_ORDER = "bottom_top" | |
type = continuous | |
units=35 | |
NOTTA = "HELLO" | |
data = "hello" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! Copyright (c) 2013, Los Alamos National Security, LLC (LANS) | |
! and the University Corporation for Atmospheric Research (UCAR). | |
! | |
! Unless noted otherwise source code is licensed under the BSD license. | |
! Additional copyright and license information can be found in the LICENSE file | |
! distributed with this code, or at http://mpas-dev.github.com/license.html | |
! | |
module init_atm_core | |
contains | |
function init_atm_core_init(domain, startTimeStamp) result(ierr) | |
use mpas_derived_types | |
use mpas_stream_manager | |
use mpas_io_streams, only : MPAS_STREAM_NEAREST | |
use init_atm_cases | |
implicit none | |
type (domain_type), intent(inout) :: domain | |
character(len=*), intent(out) :: startTimeStamp | |
type (block_type), pointer :: block | |
type (mpas_pool_type), pointer :: state, mesh | |
character (len=StrKIND), pointer :: xtime | |
character (len=StrKIND), pointer :: initial_time | |
character (len=StrKIND), pointer :: config_start_time | |
real (kind=RKIND), pointer :: sphere_radius | |
integer :: ierr | |
ierr = 0 | |
block => domain % blocklist | |
do while (associated(block)) | |
call mpas_pool_get_subpool(block % structs, 'state', state) | |
call mpas_pool_get_subpool(block % structs, 'mesh', mesh) | |
call mpas_pool_get_array(state, 'xtime', xtime) | |
call mpas_pool_get_array(state, 'initial_time', initial_time) | |
call mpas_pool_get_config(mesh, 'sphere_radius', sphere_radius) | |
call mpas_pool_get_config(block % configs, 'config_start_time', config_start_time) | |
startTimeStamp = config_start_time | |
xtime = config_start_time | |
initial_time = config_start_time | |
domain % sphere_radius = a ! Appears in output files | |
sphere_radius = a ! Used in setting up test cases | |
block => block % next | |
end do | |
call MPAS_stream_mgr_add_att(domain % streamManager, 'sphere_radius', domain % sphere_radius, streamID='output', ierr=ierr) | |
call MPAS_stream_mgr_add_att(domain % streamManager, 'sphere_radius', domain % sphere_radius, streamID='surface', ierr=ierr) | |
! | |
! We don't actually expect the time in the (most likely 'static') file to | |
! match the time in the namelist, so just read whatever time we find in | |
! the input file. | |
! | |
call MPAS_stream_mgr_read(domain % streamManager, whence=MPAS_STREAM_NEAREST, ierr=ierr) | |
call MPAS_stream_mgr_reset_alarms(domain % streamManager, direction=MPAS_STREAM_INPUT, ierr=ierr) | |
end function init_atm_core_init | |
function init_atm_core_run(domain) result(ierr) | |
use mpas_derived_types | |
use mpas_stream_manager | |
use mpas_timer | |
use init_atm_cases | |
use mpas_pool_routines | |
use mpas_parse_geoindex | |
implicit none | |
type (domain_type), intent(inout) :: domain | |
integer :: ierr | |
character(len=StrKind) :: fname | |
type (mpas_pool_type), pointer :: test_pool | |
character(len=StrKind), pointer :: char_ptr | |
integer, pointer :: int_ptr | |
real, pointer :: real_ptr | |
ierr = 0 | |
fname = 'geog_test/index' | |
call mpas_pool_create_pool(test_pool) | |
ierr = mpas_parse_index(fname, test_pool) | |
if (ierr /= 0) then | |
call mpas_log_write("Failed! Could not parse index succesfully", messageType=MPAS_LOG_CRIT) | |
endif | |
! Integers | |
call mpas_pool_get_config(test_pool, 'category_max', int_ptr) | |
write(0,*) "category_max: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'category_min', int_ptr) | |
write(0,*) "category_min: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'filename_digits', int_ptr) | |
write(0,*) "filename_digits: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'iswater', int_ptr) | |
write(0,*) "iswater: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'isice', int_ptr) | |
write(0,*) "isice: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'islake', int_ptr) | |
write(0,*) "islake: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'isoilwater', int_ptr) | |
write(0,*) "isoilwater: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'isurban', int_ptr) | |
write(0,*) "isurban: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'tile_x', int_ptr) | |
write(0,*) "tile_x: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'tile_y', int_ptr) | |
write(0,*) "tile_y: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'tile_z', int_ptr) | |
write(0,*) "tile_z: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'tile_z_start', int_ptr) | |
write(0,*) "tile_z_start: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'tile_z_end', int_ptr) | |
write(0,*) "tile_z_end: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'wordsize', int_ptr) | |
write(0,*) "wordsize: ", int_ptr | |
call mpas_pool_get_config(test_pool, 'signed', int_ptr) | |
write(0,*) "signed: ", int_ptr | |
! Reals | |
call mpas_pool_get_config(test_pool, 'dx', real_ptr) | |
write(0,*) "dx: ", real_ptr | |
call mpas_pool_get_config(test_pool, 'dy', real_ptr) | |
write(0,*) "dy: ", real_ptr | |
call mpas_pool_get_config(test_pool, 'known_lat', real_ptr) | |
write(0,*) "known_lat: ", real_ptr | |
call mpas_pool_get_config(test_pool, 'known_lon', real_ptr) | |
write(0,*) "known_lon: ", real_ptr | |
call mpas_pool_get_config(test_pool, 'missing_value', real_ptr) | |
write(0,*) "missing_value: ", real_ptr | |
call mpas_pool_get_config(test_pool, 'known_x', real_ptr) | |
write(0,*) "known_x: ", real_ptr | |
call mpas_pool_get_config(test_pool, 'known_y', real_ptr) | |
write(0,*) "known_y: ", real_ptr | |
call mpas_pool_get_config(test_pool, 'scale_factor', real_ptr) | |
write(0,*) "scale_factor: ", real_ptr | |
call mpas_pool_get_config(test_pool, 'stdlon', real_ptr) | |
write(0,*) "stdlon: ", real_ptr | |
call mpas_pool_get_config(test_pool, 'truelat1', real_ptr) | |
write(0,*) "truelat1: ", real_ptr | |
call mpas_pool_get_config(test_pool, 'truelat2', real_ptr) | |
write(0,*) "truelat2: ", real_ptr | |
! Descriptions | |
call mpas_pool_get_config(test_pool, 'description', char_ptr) | |
write(0,*) "description: ", trim(char_ptr) | |
call mpas_pool_get_config(test_pool, 'endian', char_ptr) | |
write(0,*) "endian: ", trim(char_ptr) | |
call mpas_pool_get_config(test_pool, 'mminlu', char_ptr) | |
write(0,*) "mminlu: ", trim(char_ptr) | |
call mpas_pool_get_config(test_pool, 'projection', char_ptr) | |
write(0,*) "projection: ", trim(char_ptr) | |
call mpas_pool_get_config(test_pool, 'row_order', char_ptr) | |
write(0,*) "row_order: ", trim(char_ptr) | |
call mpas_pool_get_config(test_pool, 'type', char_ptr) | |
write(0,*) "type: ", trim(char_ptr) | |
call mpas_pool_get_config(test_pool, 'units', char_ptr) | |
write(0,*) "units: ", trim(char_ptr) | |
end function init_atm_core_run | |
function init_atm_core_finalize(domain) result(ierr) | |
use mpas_derived_types | |
use mpas_decomp | |
use mpas_stream_manager | |
use mpas_log, only : mpas_log_write | |
implicit none | |
type (domain_type), intent(inout) :: domain | |
integer :: ierr | |
ierr = 0 | |
call mpas_decomp_destroy_decomp_list(domain % decompositions) | |
call mpas_log_write('') | |
call mpas_log_write('********************************************************') | |
call mpas_log_write(' Finished running the init_atmosphere core') | |
call mpas_log_write('********************************************************') | |
end function init_atm_core_finalize | |
end module init_atm_core |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment