Open gpbalsamo opened 1 year ago
Hi Gianpaolo,
I believe we changed the function signature for titanlib.sct() since that example has been posted. Thomas Nipen (@tnipen) can confirm this. I suggest you look more into the examples in the two repositories:
https://github.com/metno/gridpp (wiki https://github.com/metno/gridpp/wiki) tests: https://github.com/metno/gridpp/tree/master/tests
https://github.com/metno/titanlib (wiki https://github.com/metno/titanlib/wiki) queste due pagine sono sicuro che sono aggiornate. tests: https://github.com/metno/titanlib/tree/master/tests
For instance, in the file https://github.com/metno/titanlib/blob/master/tests/sct_test.py you may find an example of how to use titanlib.sct(), which is updated with the most recent version of the function. See here: https://github.com/metno/titanlib/blob/master/include/titanlib.h (from line 67 to line 102)
Hope this helps, Cristian
[like] Gianpaolo Balsamo reacted to your message:
From: Cristian Lussana @.> Sent: Tuesday, June 13, 2023 8:53:24 AM To: metno/titanlib @.> Cc: Gianpaolo Balsamo @.>; Author @.> Subject: Re: [metno/titanlib] sct expected at most 15 arguments, got 16 (Issue #25)
Hi Gianpaolo,
I believe we changed the function signature for titanlib.sct() since that example has been posted. Thomas Nipen @.***https://github.com/tnipen) can confirm this. I suggest you look more into the examples in the two repositories:
https://github.com/metno/gridpp (wiki https://github.com/metno/gridpp/wiki) tests: https://github.com/metno/gridpp/tree/master/tests
https://github.com/metno/titanlib (wiki https://github.com/metno/titanlib/wiki) queste due pagine sono sicuro che sono aggiornate. tests: https://github.com/metno/titanlib/tree/master/tests
For instance, in the file https://github.com/metno/titanlib/blob/master/tests/sct_test.py you may find an example of how to use titanlib.sct(), which is updated with the most recent version of the function. See here: https://github.com/metno/titanlib/blob/master/include/titanlib.h (from line 67 to line 102)
Hope this helps, Cristian
— Reply to this email directly, view it on GitHubhttps://github.com/metno/titanlib/issues/25#issuecomment-1588846587, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA6FPMDEXBBXOJWNCEKUP73XLATAJANCNFSM6AAAAAAZDW3ZRQ. You are receiving this because you authored the thread.Message ID: @.***>
Hi Cristian and Thomas,
Many thanks for your prompt reply.
First of all, congrats on the gridpp titanlib developments, which are really useful and easy to use. I add Tiago who is leading development of several libraries here at ECMWF and we both got interested.
I was trying to update the example on this page as it was closer to what I was trying to go, a T2m OI analysis on the IFS grid fields and the new Earthkit library Tiago has produced.
I have succeeded reproducing the OI analysis for T2m.
Attached a python example (as jupyter notebook, but I also reproduce it below in ascii).
What we would like to know is how the optimal interpolation are done and if possible to access scripts example codes that allow to reproduce for instance what is done in this study https://www.diva-portal.org/smash/get/diva2:1613464/FULLTEXT01.pdf
We are also generally interested in the QC aspects of observations. Personally I am also very interested in the ensemble version documented in Cristian paper.
All suggestions welcome. All the best, Gianpaolo
[optimum-interpolation-of-2m-air-temperature]] == Optimum Interpolation of 2m Air Temperature
date_ext="2023-06-09" time_ext="12" step_ext="0" obs_name="airTemperatureAt2M" fg_name=["2t","z"] nlat=1804 nlon=3604 grid_ext=[180./nlat,360./nlon] print (obs_name,"analysis increment on latlon grid :",grid_ext)
[cols=",,,,",options="header",] |========================================================== | |latitude |longitude |heightOfStation |airTemperatureAt2M |0 |-4.26 |15.24 |316 |302.8 |1 |-3.44 |114.75 |20 |299.0 |2 |18.41 |103.52 |298 |298.4 |3 |-15.57 |-175.62 |61 |298.0 |4 |-15.95 |-173.77 |3 |297.7 |... |... |... |... |... |4445 |49.63 |6.23 |369 |298.3 |4446 |32.37 |36.25 |683 |303.6 |4447 |31.98 |35.98 |779 |302.2 |4448 |31.72 |35.98 |722 |303.8 |4449 |-62.23 |-58.79 |11 |267.3 |==========================================================
inner_radius = 50000 outer_radius = 100000 num_min = 5 num_max = 100 num_iterations = 1 num_min_prof = 20 dzmin = 100 dhmin = 10000 dz = 200 t2pos = np.full(len(obs), 4) t2neg = np.full(len(obs), 4) eps2 = np.full(len(obs), 0.5)
gradient = -0.0065 background = gridpp.simple_gradient(bgrid, bgrid, background, gradient) points = gridpp.Points(valid_obs_lats, valid_obs_lons, valid_obs)
pbackground = gridpp.bilinear(bgrid, points, background)
variance_ratios = np.full(points.size(), 0.5)
h = 300000 v = 800 structure = gridpp.BarnesStructure(h, v)
+Out[34]:+ ----3.740265----
+Out[35]:+ -----3.257904----
+Out[38]:+ ----0.0----
[[plotting]] == Plotting
coastlines = mv.mcoast( map_coastline_resolution="high", map_coastline_sea_shade="on", map_coastline_sea_shade_colour="RGB(0.4845,0.6572,0.9351)", )
coastlines = mv.mcoast( map_coastline_resolution="high", map_coastline_sea_shade="on", map_coastline_sea_shade_colour="RGB(0.4845,0.6572,0.9351)", map_grid_frame_colour="grey", map_grid_frame_line_style="dash", map_grid_frame="off", map_coastline="on", map_label="off",
)
From: Cristian Lussana @.> Date: Tuesday, 13 June 2023 at 09:53 To: metno/titanlib @.> Cc: Gianpaolo Balsamo @.>, Author @.> Subject: Re: [metno/titanlib] sct expected at most 15 arguments, got 16 (Issue #25)
Hi Gianpaolo,
I believe we changed the function signature for titanlib.sct() since that example has been posted. Thomas Nipen @.***https://github.com/tnipen) can confirm this. I suggest you look more into the examples in the two repositories:
https://github.com/metno/gridpp (wiki https://github.com/metno/gridpp/wiki) tests: https://github.com/metno/gridpp/tree/master/tests
https://github.com/metno/titanlib (wiki https://github.com/metno/titanlib/wiki) queste due pagine sono sicuro che sono aggiornate. tests: https://github.com/metno/titanlib/tree/master/tests
For instance, in the file https://github.com/metno/titanlib/blob/master/tests/sct_test.py you may find an example of how to use titanlib.sct(), which is updated with the most recent version of the function. See here: https://github.com/metno/titanlib/blob/master/include/titanlib.h (from line 67 to line 102)
Hope this helps, Cristian
— Reply to this email directly, view it on GitHubhttps://github.com/metno/titanlib/issues/25#issuecomment-1588846587, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA6FPMDEXBBXOJWNCEKUP73XLATAJANCNFSM6AAAAAAZDW3ZRQ. You are receiving this because you authored the thread.Message ID: @.***>
Dear Gianpaolo.
Thanks for letting us know about the incorrect code in the blog post. I have updated it to reflect the changes that were made to titanlib.
Thomas
Hi, In the example posted here https://tnipen.github.io/2020/06/15/titanlib-gridpp.html the call to sct generates an error and I report here a log:
TypeError Traceback (most recent call last) Cell In[142], line 14 11 t2neg = np.full(len(obs), 4) 12 eps2 = np.full(len(obs), 0.5) ---> 14 flags, sct, rep = titanlib.sct(obs_lats, obs_lons1, obs_elevs, obs, num_min, num_max, inner_radius, outer_radius, num_iterations, num_min_prof, dzmin, dhmin , dz, t2pos, t2neg, eps2)
File ~/.local/lib/python3.10/site-packages/titanlib.py:883, in sct(args) 882 def sct(args): --> 883 return _titanlib.sct(*args)
TypeError: sct expected at most 15 arguments, got 16 Additional information: Wrong number or type of arguments for overloaded function 'sct'. Possible C/C++ prototypes are: titanlib::sct(titanlib::Points const &,titanlib::vec const &,int,int,float,float,int,int,float,float,float,titanlib::vec const &,titanlib::vec const &,titanlib::vec const &,titanlib::vec &,titanlib::vec &,titanlib::ivec const &) titanlib::sct(titanlib::Points const &,titanlib::vec const &,int,int,float,float,int,int,float,float,float,titanlib::vec const &,titanlib::vec const &,titanlib::vec const &,titanlib::vec &,titanlib::vec &)