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

Importer for AVAPS dropsondes (operated e.g. on HALO). #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AnWalbroel
Copy link

Measurement gaps will be filled via linear interpolation and missing measurements between the
aircraft altitude and the first recorded dropsonde measurement are filled with extrapolation. The
extrapolation is based on BAHAMAS measurements (if available) or otherwise guessed from the
existing measurements. After having measurement gaps filled, outliers are marked and, if a certain
threshold is exceeded, smoothed out. Finally, the dropsonde measurements are interpolated on a 10
m grid.

Measurement gaps will be filled via linear interpolation and missing measurements between the
aircraft altitude and the first recorded dropsonde measurement are filled with extrapolation. The
extrapolation is based on BAHAMAS measurements (if available) or otherwise guessed from the
existing measurements. After having measurement gaps filled, outliers are marked and, if a certain
threshold is exceeded, smoothed out. Finally, the dropsonde measurements are interpolated on a 10
m grid.
@AnWalbroel
Copy link
Author

Is it okay to leave the dropsonde processing routines inside the importer.py module or shall it be moved elsewhere to keep the importer "clean"?

Copy link
Collaborator

@MeraX MeraX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks quite nice. Thank you for this work!
It's a lot of code and I just had a quick look. At the first glace, it looks quite verbose and useful. One should check the code e.g. with an polar dropsonde. Question remains whether such a long importer is ok in importer.py or if some code should be shifted to a separate module.

Attached to this comment are two minor code-comments. A third would be that there are some not-needed empty lines for my taste.

if ceiling > 15000:
raise ValueError("Dropsonde launch altitude appears to be > 15000 m. Extrapolation is aborted because the " +
"tropopause may intervene.\n")
return new_dict, new_ipflag_dict
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This return will never happen as the ValueError breaks the code flow.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, forgot to remove it.

Comment on lines 4027 to 4049
# 4d variables: hydrometeors:
shape4d = [Nx, Nx, Nh-1, 5] # potentially 5 hydrometeor classes with this setting
pamData['hydro_q'] = np.zeros(shape4d)
pamData['hydro_q'][...,0] = 0# CLOUD
pamData['hydro_q'][...,1] = 0# ICE
pamData['hydro_q'][...,2] = 0# RAIN
pamData['hydro_q'][...,3] = 0# SNOW
pamData['hydro_q'][...,4] = 0# GRAUPEL


# Descriptorfile must be included. otherwise, pam.p.nhydro would be 0 which is not permitted.
descriptorFile = np.array([
#['hydro_name' 'as_ratio' 'liq_ice' 'rho_ms' 'a_ms' 'b_ms' 'alpha_as' 'beta_as' 'moment_in' 'nbin' 'dist_name' 'p_1' 'p_2' 'p_3' 'p_4' 'd_1' 'd_2' 'scat_name' 'vel_size_mod' 'canting']
('cwc_q', -99.0, 1, -99.0, -99.0, -99.0, -99.0, -99.0, 3, 1, 'mono', -99.0, -99.0, -99.0, -99.0, 2e-05, -99.0, 'mie-sphere', 'khvorostyanov01_drops', -99.0),
('iwc_q', -99.0, -1, -99.0, 130.0, 3.0, 0.684, 2.0, 3, 1, 'mono_cosmo_ice', -99.0, -99.0, -99.0, -99.0, -99.0, -99.0, 'mie-sphere', 'heymsfield10_particles', -99.0),
('rwc_q', -99.0, 1, -99.0, -99.0, -99.0, -99.0, -99.0, 3, 50, 'exp', -99.0, -99.0, 8000000.0, -99.0, 0.00012, 0.006, 'mie-sphere', 'khvorostyanov01_drops', -99.0),
('swc_q', -99.0, -1, -99.0, 0.038, 2.0, 0.3971, 1.88, 3, 50, 'exp_cosmo_snow', -99.0, -99.0, -99.0, -99.0, 5.1e-11, 0.02, 'mie-sphere', 'heymsfield10_particles', -99.0),
('gwc_q', -99.0, -1, -99.0, 169.6, 3.1, -99.0, -99.0, 3, 50, 'exp', -99.0, -99.0, 4000000.0, -99.0, 1e-10, 0.01, 'mie-sphere', 'khvorostyanov01_spheres', -99.0)],
dtype=[('hydro_name', 'S15'), ('as_ratio', '<f8'), ('liq_ice', '<i8'), ('rho_ms', '<f8'), ('a_ms', '<f8'), ('b_ms', '<f8'), ('alpha_as', '<f8'), ('beta_as', '<f8'),
('moment_in', '<i8'), ('nbin', '<i8'), ('dist_name', 'S15'), ('p_1', '<f8'), ('p_2', '<f8'), ('p_3', '<f8'),
('p_4', '<f8'), ('d_1', '<f8'), ('d_2', '<f8'), ('scat_name', 'S15'), ('vel_size_mod', 'S30'), ('canting', '<f8')]
)
for hyd in descriptorFile: pam.df.addHydrometeor(hyd)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could skip this for a clear sky simulation

pamData['lat'] = np.broadcast_to(sonde_dict['lat'][~np.isnan(sonde_dict['lat'])][-1], shape2d)

pamData['timestamp'] = np.broadcast_to(sonde_dict['launch_time'], shape2d)
pamData['groundtemp'] = np.broadcast_to(sonde_dict['T'][0], shape2d)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more comment: I would prefer the groundtemp to be optionally passed as argument. You assume here, that air temperature at 15 or 30 m above the surface is in equilibrium with the sea. That is not always the case. (e.g. in the Arctic). I think more flexibility here would be great.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sonde_dict['T'][0] is not at 15 or 30 m but a linearly extrapolated value from the lowest dropsonde measurements. Anyway, it certainly does not equal the sea surface temperature.

This would require additional input information to the importer function. I'll add a sst=np.nan argument to the function read_AVAPS_dropsonde(...).

Copy link
Collaborator

@MeraX MeraX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@DaveOri
Copy link
Collaborator

DaveOri commented Jun 15, 2022

I think we lost track of this pull request. Now it has some conflicts, but I guess it is just a matter of moving the importer to some different lines. @AnWalbroel can you do that?

@AnWalbroel
Copy link
Author

Hi Davide,

I'll certainly look into it... but if it isn't urgent, I would rather do it when I return from the ship.

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

Successfully merging this pull request may close these issues.

3 participants