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

dba_qcfilter scarta tutte i context (livello, timerange) tranne uno. #1

Closed
edigiacomo opened this issue Oct 15, 2015 · 2 comments
Closed
Assignees
Labels

Comments

@edigiacomo
Copy link
Member

Il comando dba_qcfilter pare scartare tutte le var tranne quelle statiche (nome stazione, altezza, etc) e quelle relative ad un solo context.

Le prove sono effettuate con libsim-6.1.0-1506.

Ho committato il file di prova dba_qcfilter-bug.bufr nella directory data del branch dba_qcfilter-bug-1.

Il file di test (BUFR generico) contiene un solo messaggio con 4 context:

$ dbamsg dump --interpreted dba_qcfilter-bug.bufr
#0[0] generic message with 4 contexts:
Level 1,-,-,-  tr 1,0,3600  1 vars:
013011 TOTAL PRECIPITATION / TOTAL WATER EQUIVALENT(KG/M**2): 0.2
Level 1,-,-,-  tr 1,0,86400  1 vars:
013011 TOTAL PRECIPITATION / TOTAL WATER EQUIVALENT(KG/M**2): 7.4
Level 103,2000,-,-  tr 254,0,0  2 vars:
012101 TEMPERATURE/DRY-BULB TEMPERATURE(K): 287.95
013003 RELATIVE HUMIDITY(%): 94
Level -,-,-,-  tr -,-,-  6 vars:
001019 LONG STATION OR SITE NAME(CCITTIA5): Camse
001194 [SIM] Report mnemonic(CCITTIA5): locali
005001 LATITUDE (HIGH ACCURACY)(DEGREE): 44.60016
006001 LONGITUDE (HIGH ACCURACY)(DEGREE): 12.07738
007030 HEIGHT OF STATION GROUND ABOVE MEAN SEA LEVEL (SEE NOTE 3)(M): -1.0
007031 HEIGHT OF BAROMETER ABOVE MEAN SEA LEVEL (SEE NOTE 4)(M): 0.0

Filtrando con dba_qcfilter, viene scartata tutto tranne il context di anagrafica e uno degli altri 3:

$ dba_qcfilter < dba_qcfilter-bug.bufr | dbamsg dump --interpreted
#0[0] generic message with 2 contexts:
Level 103,2000,-,-  tr 254,0,0  2 vars:
012101 TEMPERATURE/DRY-BULB TEMPERATURE(K): 287.95
013003 RELATIVE HUMIDITY(%): 94
Level -,-,-,-  tr -,-,-  6 vars:
001019 LONG STATION OR SITE NAME(CCITTIA5): Camse
001194 [SIM] Report mnemonic(CCITTIA5): locali
005001 LATITUDE (HIGH ACCURACY)(DEGREE): 44.60016
006001 LONGITUDE (HIGH ACCURACY)(DEGREE): 12.07738
007030 HEIGHT OF STATION GROUND ABOVE MEAN SEA LEVEL (SEE NOTE 3)(M): -1.0
007031 HEIGHT OF BAROMETER ABOVE MEAN SEA LEVEL (SEE NOTE 4)(M): 0.0

Ho sospetto che nell'output mantenga solo l'ultimo dei context letti, sovrascrivendo i precedenti (con l'esclusione di quella di anagrafica).

@edigiacomo edigiacomo added the bug label Oct 15, 2015
@edigiacomo edigiacomo assigned dcesari and pat1 and unassigned dcesari and pat1 Oct 15, 2015
@pat1 pat1 assigned spanezz and unassigned pat1 Oct 20, 2015
@pat1
Copy link
Contributor

pat1 commented Oct 20, 2015

riducendo la sequenza fortran a:

connection=dbaconnection(dsn="mem:")
sessionfrom=dbasession(connection,write=.true.,wipe=.true.)
call sessionfrom%messages_open_input(filename=input_file,mode="r",format="BUFR",simplified=.true.)
call sessionfrom%messages_open_output(filename=output_file,mode="w",format="BUFR")
do while (sessionfrom%messages_read_next())
call sessionfrom%messages_write_next()
call sessionfrom%remove_all()
end do
call sessionfrom%delete()

Si produce il seguente trace di chiamate alle api dballe fortran:

// ** Execution begins **
auto_ptr db0(DB::connect_from_url("mem:"));
DbAPI dbapi0(*db0, "write", "write", "write");
dbapi0.scopa();
dbapi0.messages_open_input("", "r", BUFR, true);
dbapi0.messages_open_output("", "w", BUFR);
ires = dbapi0.messages_read_next();
wassert(actual(ires) == 1);
dbapi0.messages_write_next("");
dbapi0.remove_all();
ires = dbapi0.messages_read_next();
wassert(actual(ires) == 0);
// dbapi0 not used anymore
trace.log (END)

che funziona senza perdere variabili

@pat1 pat1 assigned pat1 and unassigned spanezz Oct 20, 2015
@pat1
Copy link
Contributor

pat1 commented Oct 20, 2015

il problema era l'assenza di una unsetall prima dell'export:
call sessionfrom%unsetall()
call sessionfrom%messages_write_next()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants