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~2 FileMetadata%add_variable proc~test_write_read_simple_variable->none~add_variable~2 none~create NetCDF4_FileFormatter%create proc~test_write_read_simple_variable->none~create insert insert none~add_dimension->insert proc~mapl_return MAPL_Return none~add_dimension->proc~mapl_return at at none~add_variable~2->at begin begin none~add_variable~2->begin get get none~add_variable~2->get interface~mapl_assert MAPL_Assert none~add_variable~2->interface~mapl_assert next next none~add_variable~2->next none~get_const_value Variable%get_const_value none~add_variable~2->none~get_const_value none~get_dimensions Variable%get_dimensions none~add_variable~2->none~get_dimensions none~get_shape UnlimitedEntity%get_shape none~add_variable~2->none~get_shape none~insert~7 StringVariableMap%insert none~add_variable~2->none~insert~7 none~is_empty UnlimitedEntity%is_empty none~add_variable~2->none~is_empty none~add_variable~2->proc~mapl_return push_back push_back none~add_variable~2->push_back nf90_create nf90_create none~create->nf90_create none~create->proc~mapl_return proc~mapl_verify MAPL_Verify none~create->proc~mapl_verify none~get_shape->proc~mapl_return none~insert_pair StringVariableMap%insert_pair none~insert~7->none~insert_pair 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