Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Accessing data from UAL requires some modification to your code. In this part of tutorial, we will take a closer look on how to access IDS via UAL.

Table of Contents

 

Warning

Warning

Stop here for a moment. Make sure you have followed the configuration setup before proceeding any further!

Configuration related tutorial is here -> Click me! <-

 

3.1 Accessing data using Fortran

CHEAT SHEET
ITMIMAS
use euitm_schemas
use ids_schemas
use euitm_routines
use ids_routines
type (type_<cpo_name>) :: cpo 
type (ids_<ids_name>) :: ids 
type (type_<cpo_name>), pointer :: cpoArray(:) ! <= Array !!!
type (ids_<ids_name>) :: ids <== SINGLE OBJ !!!
call euitm_create('euitm', shot, run, refShot, refRun, idx)
call imas_create('ids', shot, run, refShot, refRun, idx)
call euitm_open('euitm', shot, run, idx)
call imas_open('ids', shot, run, idx)
call euitm_put(idx, '<cpo_name>', cpoArray) <== ARRAY!
call ids_put(idx, '<ids_name>', ids)  <== SINGLE OBJ
call euitm_put_non_timed(idx,"<cpo_name>", cpo)
call ids_put_non_timed(idx,"<ids_name>",ids)
call euitm_put_slice(idx, '<cpo_name>', cpo)
call ids_put_slice(idx, '<ids_name>', ids)
call euitm_deallocate(cpoArray)
call ids_deallocate(ids)
call euitm_close(idx)
call imas_close(idx)
call euitm_enable_mem_cache(idx)
call imas_enable_mem_cache(idx)
call euitm_disable_mem_cache(idx)
call imas_disable_mem_cache(idx)
call euitm_flush_all(idx)
call imas_flush_all(idx)

 

 

4. Open example file

put() CPO vs IDS
Code Block
titleITM
linenumberstrue
program diagnostic
    use euitm_schemas
    use euitm_routines
    implicit none

    integer :: idx, i, arraySize
    type (type_equilibrium), pointer :: cpocpoArray(:) ! <= SingleArray object !!!

	! Open a database
    call euitm_create('euitm', 11, 22, -1, -1, idx)





	! CPO structure allocation
	
allocate(cpoArray(10))

!SCALARS (!)
	do i=1, 10
  	cpo%time  	cpoArray(i)%time = VALUE
        cpo%x%ycpoArray(i)%x%y = VALUE
    enddo
    




call euitm_put_slice(idx, 'equilibrium', cpocpoArray)
call euitm_deallocate(cpoArray)
    ! Close a pulse file
    call euitm_close(idx)
end program
Code Block
titleIMAS
linenumberstrue
program diagnostic
    use ids_schemas
    use ids_routines
    implicit none

    integer :: idx, i
    type (ids_core_profiles) :: ids ! <= Single object !!!

	! Open a database
    call imas_create('ids', 11, 22, -1, -1, idx)
  
   ! Mandatory to define this property
    ids%ids_properties%homogeneous_time = 1 

! IDS structure allocation
allocate(ids%ids_properties%commentids%time(1))
 ids%ids_properties%comment(1) = 'A test ids put using put_slice'
 call ids_put_non_timed(idx,"core_profiles",ids)


 ! IDS structure allocation
allocate(ids%time(1))
allocate(ids%x%y(1))   
 
!SCALARS (!)allocate(ids%x%y(1))

 !SCALARS (!)
	do i=1, 10
    	ids%time(i) = VALUE
        ids%x%y(i) = VALUE
    enddo
! VECTORS
    	ids%time(1) = VALUEtimeVector
        ids%x%y(1)  = VALUEvalueVector


call ids_put_slice(idx, 'core_profiles', ids)
	call ids_deallocate(ids)
! Close a pulse file
    call imas_close(idx)
end program

 

 

 

Let's check how to read these data in Fortran.

 

 

 

4. Open example file

putSlice() CPO vs IDS
Code Block
titleITM
linenumberstrue
program diagnostic
    use euitm_schemas
    use euitm_routines
    implicit none

    integer :: idx, i
    type (type_equilibrium) :: cpo ! <= Single object !!!

	! Open   use euitm_schemasa database
    usecall euitm_routines
    implicit none

    integer :: idx, i, arraySize
    type (type_equilibrium), pointer :: cpoArray(:) ! <= Array !!!

	! Open a databasecreate('euitm', 11, 22, -1, -1, idx)





	! Time NOT dependent data
	allocate(cpo%datainfo%dataprovider(1))  
 	cpo%datainfo%dataprovider="FI"
	call euitm_put_non_timed(idx, 'equilibrium', cpo)





	cpo%time = VALUE
    cpo%x%y = VALUE
   
    call euitm_put_createslice(idx, 'euitmequilibrium', 11, 22, -1, -1, idx)





	! CPO structure allocation
	allocate(cpoArray(10))

!SCALARS (!)
	do i=1, 10
    	cpoArray(i)%time = VALUE
        cpoArray(i)%x%y = VALUE
    enddo
    




call euitm_put(idx, 'equilibrium', cpoArray)
call euitm_deallocate(cpoArray)
    ! Close a pulse file
    call euitm_close(idx)
end programcpo)	
	
	call euitm_deallocate(cpoArray)
    
	! Close a pulse file
    call euitm_close(idx)
end program
Code Block
titleIMAS
linenumberstrue
program diagnostic
    use ids_schemas
    use ids_routines
    implicit none

    integer :: idx, i
    type (ids_core_profiles) :: ids ! <= Single object !!!

	! Open a database
    call imas_create('ids', 11, 22, -1, -1, idx)
  
   	! Mandatory to define this property
   	ids%ids_properties%homogeneous_time = 1 

	! Time NOT dependent data
	allocate(ids%ids_properties%comment(1))
 	ids%ids_properties%comment(1) = 'A test ids put using put_slice'
 	call ids_put_non_timed(idx,"core_profiles",ids)

 	
Code Block
titleIMAS
linenumberstrue
program diagnostic
    use ids_schemas
    use ids_routines
    implicit none

    integer :: idx, i
    type (ids_core_profiles) :: ids ! <= Single object !!!

	! Open a database
    call imas_create('ids', 11, 22, -1, -1, idx)
  
   ! Mandatory to define this property
    ids%ids_properties%homogeneous_time = 1 

! IDS structure allocation
	allocate(ids%time(1))
allocate(ids%x%y(1))

 !SCALARS (!)
	do i=1, 10
    	ids%time(i) = VALUE
        ids%x%y(i) = VALUE
 
	allocate(ids%x%y(1))   enddo
! VECTORS
    	ids%time(1) = timeVectorVALUE
        ids%x%y(1)  = valueVectorVALUE


	call ids_put_slice(idx, 'core_profiles', ids)
	
	call ids_deallocate(ids)
	
	! Close a pulse file
    call imas_close(idx)
end program

 

 

 

...

 

3.2 Accessing data using Fortran

...