Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create obsoul2json #10

Open
trygveasp opened this issue Sep 15, 2022 · 0 comments
Open

Create obsoul2json #10

trygveasp opened this issue Sep 15, 2022 · 0 comments
Assignees

Comments

@trygveasp
Copy link
Collaborator

Needed for CARRA2

Reading in bator:

READ (NULOBI,*,iostat=iret) ival1,ival2
if (iret /= 0) then
  WRITE(cl_error,'("ERR : bator_lecobsoul0 : OBsoul incorrect ",A)') nomfic
  CALL Abor1(TRIM(cl_error))
endif
do while (iret == 0)
  READ (NULOBI,'(I4,1X,I2,1X,I9,1X,F9.5,1X,F10.5,2X,A10,2X,I8,1X,I6,1X,ES12.5,1X,I5)',advance='no',iostat=iret)&
      & ival1,iotp,ioch,zval1,zval2,cval,ival2,ival3,zval3,inbw
  READ(NULOBI,*,iostat=iret) (ztval(:),j=1,inbw)
  select case(iret)
  case(:-1)
    print *, "FIN DE FICHIER"
    exit
  case(1:)
    WRITE(cl_error,'("ERR : bator_lecobsoul0 : OBsoul incorrect ",A)') nomfic
    CALL Abor1(TRIM(cl_error))
  case default
    TREF_FICOBS(kfic)%nbwag=TREF_FICOBS(kfic)%nbwag+inbw
    TREF_FICOBS(kfic)%nbobs=TREF_FICOBS(kfic)%nbobs+1
    icodmes = MOD(ioch,1000)
    IF (icodmes == NGTHRB) THEN
      inbw=inbw-3 ; itb(3)=1
    ELSEIF ((iotp == NSATOB).AND.(icodmes == NSTB87)) THEN
      inbw=inbw-1 ; itb(1)=1
    ELSEIF (iotp == NSCATT) THEN
      inbw=inbw-1 ; itb(1)=1
    ELSEIF (icodmes == NSSMI) THEN
      inbw=inbw-2 ; itb(2)=1
    ELSE
      itb(0)=1
    ENDIF
  end select
enddo

DEALLOCATE (ztval)
IF (sum(itb(:)) > 1) THEN
  ilnsup = -999
ELSE
  ilnsup = 0
  DO j=1,3
    ilnsup = MAX(ilnsup,itb(j)*j)
  ENDDO
  ilnsup = ilnsup*(5-1)*(-1)
ENDIF
TREF_FICOBS(kfic)%ilsup=ilnsup

Example file:
1 2
17 1 17 69.60424 63.378387 'CRYO '
20220912 60000 -2147483647.00 1 1111 0
92 999999.00 -2147483647.00 0.000 2048
17 1 17 69.64449 63.038250 'CRYO '
20220912 60000 -2147483647.00 1 1111 0
92 999999.00 -2147483647.00 0.000 2048
17 1 17 69.56326 63.152706 'CRYO '
20220912 60000 -2147483647.00 1 1111 0
92 999999.00 -2147483647.00 0.100 2048
17 1 17 69.48195 63.266266 'CRYO '

@trygveasp trygveasp self-assigned this Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant