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

Something wrong with the computation of Av? #30

Open
jfigui opened this issue May 9, 2023 · 13 comments
Open

Something wrong with the computation of Av? #30

jfigui opened this issue May 9, 2023 · 13 comments

Comments

@jfigui
Copy link

jfigui commented May 9, 2023

Hi @jleinonen ,

When I compute Ah and Av of rain with a prescribed canting angle using the psd_integrator I get exactly the same results for Ah and for Av. In fact the parameter h_pol in radar.Ai(scatterer, h_pol=False) seems to be ignored when using the integrator.

I am missing something or is this indeed a bug in the code?

Cheers,

@jfigui

@jleinonen
Copy link
Owner

Looking at the code I don't see why it would be ignored. radar.Ai calls scatter.ext_xsect which does behave differently (uses a different element of the matrix S) based on h_pol. Could you post a working example of that replicates the problem?

@jfigui
Copy link
Author

jfigui commented May 10, 2023

diam_min = 0.1
diam_max = 7.
step = 0.1
diam = np.arange(diam_min, diam_max+step, step)
num_points = diam.size
canting_angle = 10.

geom_back = (90.0, 90.0, 0.0, 180.0, 0.0, 0.0)
geom_forw = (90.0, 90.0, 0.0, 0.0, 0.0, 0.0)

wavelength = tmatrix_aux.wl_C
m = refractive.m_w_20C[wavelength]
scatterer = Scatterer(wavelength=wavelength, m=m)
scatterer.orient = orientation.orient_averaged_fixed
scatterer.or_pdf = orientation.gaussian_pdf(canting_angle)
scatterer.psd_integrator = PSDIntegrator()
scatterer.psd_integrator.axis_ratio_func = (lambda diam: 1.0/tmatrix_aux.dsr_thurai_2007(diam))
scatterer.psd_integrator.D_max = diam_max
scatterer.psd_integrator.num_points = num_points
scatterer.psd_integrator.geometries = (geom_back, geom_forw)
scatterer.psd_integrator.init_scatter_table(scatterer, angular_integration=True, verbose=True)

psd = GammaPSD(D0=3, Nw=10e3, mu=0, D_max=diam_max)
scatterer.psd = psd
scatterer.set_geometry(geom_forw)
Ah = radar.Ai(scatterer)
Av = radar.Ai(scatterer, False)

@jfigui
Copy link
Author

jfigui commented May 10, 2023

@jleinonen,

radar.Ai(scatterer, h_pol=True) calls scatter.ext_xsect(scatterer, h_pol=h_pol)

If the PSD integrator is not None ext_xsect returns:

scatterer.psd_integrator.get_angular_integrated(
scatterer.psd, scatterer.get_geometry(), "sca_xsect")

but in this call the information of which polarization you want is lost. By default you get the horizontal polarization regardless of the intended polarization.

Am I right or I am missing something?

@jleinonen
Copy link
Owner

Looks like there's indeed a bug. I'm working on a fix.

@jfigui
Copy link
Author

jfigui commented May 10, 2023

Thanks a lot!

@jleinonen
Copy link
Owner

Hi @jfigui, could you check if it works for you with the latest commit?

@jfigui
Copy link
Author

jfigui commented May 10, 2023

Hi @jleinonen ,

It works for me now. See the output:
psd_rain_C_2000_ele00000_refl_h-A
psd_rain_C_2000_ele00000_refl_h-Adp

Could you make a new release soon? I work with the pypi package usually

@jleinonen
Copy link
Owner

I don't manage the conda package (someone created it without my knowledge) so I have little control over it. As I understand it gets updated when I create a new release.

@jfigui
Copy link
Author

jfigui commented May 10, 2023

I think if you create a new Pypi package you should get a new conda package at some point. At least this is how it works for us using conda-forge

@jfigui
Copy link
Author

jfigui commented May 10, 2023

Thanks for being so reactive. Let me know when the new release is ready

@jleinonen
Copy link
Owner

Version 0.3.3 is now on PyPI. The conda package should eventually update automatically, as mentioned.

@jfigui
Copy link
Author

jfigui commented May 11, 2023

Great!

Thanks a lot for being so reactive. For info I am using pytmatrix in a software package to compute the scattering properties of different hydrometeors. The code is now public and you can find it here: https://github.com/openradar/hydroscatt

I would be grateful if you have a look and report any bug.

@felixdelorme
Copy link

I think if you create a new Pypi package you should get a new conda package at some point. At least this is how it works for us using conda-forge

Hi, i tried conda-forge the pytmatrix module using conda install conda-forge::pytmatrix

But i keep having the same issue : PackagesNotFoundError: The following packages are not available from current channels:

  • conda-forge::pytmatrix

Current channels:

To search for alternate channels that may provide the conda package you're
looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.

I also downloaded the file and conda install it, the install work, i can see the package in my conda list, but the Channel is and the import is not working also. I think it'about the Channel but as i'm a begineer in python, i don't have a answers. How did you manage it ?

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

No branches or pull requests

3 participants