test_write_read_simple_variable Subroutine

public subroutine test_write_read_simple_variable()

Arguments

None

Calls

proc~~test_write_read_simple_variable~~CallsGraph proc~test_write_read_simple_variable test_write_read_simple_variable assertequal assertequal proc~test_write_read_simple_variable->assertequal asserttrue asserttrue proc~test_write_read_simple_variable->asserttrue none~add_dimension FileMetadata%add_dimension proc~test_write_read_simple_variable->none~add_dimension none~add_variable FileMetadata%add_variable proc~test_write_read_simple_variable->none~add_variable none~create~2 NetCDF4_FileFormatter%create proc~test_write_read_simple_variable->none~create~2 insert insert none~add_dimension->insert proc~mapl_return MAPL_Return none~add_dimension->proc~mapl_return at at none~add_variable->at begin begin none~add_variable->begin get get none~add_variable->get interface~mapl_assert MAPL_Assert none~add_variable->interface~mapl_assert next next none~add_variable->next none~get_const_value Variable%get_const_value none~add_variable->none~get_const_value none~get_dimensions Variable%get_dimensions none~add_variable->none~get_dimensions none~get_shape UnlimitedEntity%get_shape none~add_variable->none~get_shape none~insert~104 StringVariableMap%insert none~add_variable->none~insert~104 none~is_empty UnlimitedEntity%is_empty none~add_variable->none~is_empty none~add_variable->proc~mapl_return push_back push_back none~add_variable->push_back nf90_create nf90_create none~create~2->nf90_create none~create~2->proc~mapl_return proc~mapl_verify MAPL_Verify none~create~2->proc~mapl_verify none~get_shape->proc~mapl_return none~insert_pair~11 StringVariableMap%insert_pair none~insert~104->none~insert_pair~11 none~is_empty->proc~mapl_return none~get_value UnlimitedEntity%get_value none~is_empty->none~get_value proc~mapl_return->at proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception none~get_value->proc~mapl_return

Source Code

   subroutine test_write_read_simple_variable()
      type (NetCDF4_FileFormatter) :: formatter
      type (FileMetadata) :: cf_expected
      type (FileMetadata) :: cf_found
      integer :: status

      call cf_expected%add_dimension('x',1)
      call cf_expected%add_dimension('y',2)
      call cf_expected%add_variable('var', Variable(type=pFIO_INT32, dimensions='x,y'))

      call formatter%create('test.nc', rc=status)
      @assertEqual(NF90_NOERR, status)
      call formatter%write(cf_expected, rc=status)
      @assertEqual(0, NF90_NOERR)
      call formatter%close(rc=status)
      @assertEqual(0, NF90_NOERR)

      call formatter%open('test.nc', mode=NF90_NOWRITE, rc=status)
      @assertEqual(0, NF90_NOERR)
      cf_found = formatter%read(rc=status)
      call formatter%close(rc=status)
      @assertEqual(0, NF90_NOERR)

      @assertTrue(cf_expected == cf_found)

   end subroutine test_write_read_simple_variable