desihub / desisurveyops

Scripts and code for DESI Survey Operations
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

investigate wind impact on the survey #241

Open sybenzvi opened 1 month ago

sybenzvi commented 1 month ago

@crockosi has asked if we can estimate the impact of wind on the survey to assess the worth of a wind cover for DESI-2. This would need to be split into several parts:

  1. Build a history of wind speed, direction, and opening angle between the wind and telescope.
  2. Estimate the impact of wind shake.
  3. Simulate the impact on the survey if we were to apply opening angle and wind speed thresholds to observing.
sybenzvi commented 1 month ago

Item 1 requires that someone access the telemetry DB to get weather conditions over time.

Item 2 could be estimated with a proxy such as the telescope motor current, which ramps up when the telescope holding position in the wind. Shelby Gott indicates the GWC in the 4-m reports four currents called

kpno_4m.servo.criov.curr[n|s|e|w]

every 0.5 seconds. We'll have to track down if those appear in the telemetry DB, and with what names.

sybenzvi commented 1 month ago

Looking in the NERSC telemetry replicator, wind and telescope data can be accessed as follows:

environmentmonitor_tower tcs_info
wind_speed mount_az
wind_direction mount_el
mount_inposition
akremin commented 1 month ago

Capturing a comment Martin L made on the instrument call -- he mentioned that the variability of the wind was actually more important empirically than the speed itself. Klaus said there should also be measurements for that in the database.

forero commented 1 month ago

Here's a summary of our analysis investigating wind impact building upon @sybenzvi 's work of querying the telemetry database.

I've combined three data sources: exposure data (timing and telescope pointing), wind shake measurements (gust and shake counts), and wind measurements (speed, direction, gust). For each exposure, I computed several metrics taking into account their different time windows (BACKUP: 300s, BRIGHT: 600s, DARK: 1200s): sum of wind gusts and shakes, wind speed and direction statistics (average, std), and the opening angle between telescope pointing and wind direction.

From this, I found about 25% of exposures lack corresponding wind data. For exposures with high wind speeds (>30mph), I searched through the nightlogs to understand their impact. Interestingly, only about 10% of these high-wind exposures have observer comments. When comments exist, they mention various issues:

EXPID: 102090
"split, significant windshake -- wind up to ~34-35 mph, guider images were quite elongated"

EXPID: 133132
"The exposure had to be split due to spikes of wind gust that significantly reduced the survey speed"

EXPID: 176749
"Survey speed dropped significantly during exposure (60 down to below 30%) due to variable image quality probably due to rising wind speed"

EXPID: 185442
"conditions got worse midway, including wind shake, and the exposure was manually interrupted"

These examples show different wind-related impacts: significant wind shake causing elongated guider images, reduced survey speed, need to split exposures, and sometimes compounding effects with other weather conditions.

All the computed metrics and analysis code are available at https://github.com/forero/wind_effects, and the enhanced exposure data is saved in 'expanded_exposures_info.ecsv'.

Attached is a plot that shows the typical distribution of wind speed and wind/telescope opening angle.

summary_2d(1)

crockosi commented 1 month ago

Those are great plots, Jamie.

It looks like we have wind trouble at your opening angle variable >~ 50 degrees.

Lots of questions come to mind:

Is it possible to combine the dark and bright data to get a better look at the shape of the distribution in those plots of the "with wind events"? Or are the metrics different enough that isn't wise?

Do you know what is going on when we get wind shake or gust warnings when the wind is 10 mph and we are pointing at an opening angle of 140 degrees? I am surprised to see those.

It would also be interesting to know if the distribution of wind speeds in the plots without wind events (maybe for opening angles > 90) looks the same as in the full set of wind measurement data?

What is the ratio of the fraction of exposures at opening angle < 60 degrees in the wind vs. no wind data, and is that correlated with anything like wind direction or pointing azimuth? i.e., are there some conditions when we can point into the wind and mostly not get wind shake?

Cool plots!

--Connie

On Mon, Oct 28, 2024 at 3:11 PM Jaime Forero-Romero < @.***> wrote:

Here's a summary of our analysis investigating wind impact building upon @sybenzvi https://github.com/sybenzvi 's work of querying the telemetry database.

I've combined three data sources: exposure data (timing and telescope pointing), wind shake measurements (gust and shake counts), and wind measurements (speed, direction, gust). For each exposure, I computed several metrics taking into account their different time windows (BACKUP: 100s, BRIGHT: 300s, DARK: 1100s): sum of wind gusts and shakes, wind speed and direction statistics (average, std), and the opening angle between telescope pointing and wind direction.

From this, I found about 25% of exposures lack corresponding wind data. For exposures with high wind speeds (>30mph), I searched through the nightlogs to understand their impact. Interestingly, only about 10% of these high-wind exposures have observer comments. When comments exist, they mention various issues:

EXPID: 102090 "split, significant windshake -- wind up to ~34-35 mph, guider images were quite elongated"

EXPID: 133132 "The exposure had to be split due to spikes of wind gust that significantly reduced the survey speed"

EXPID: 176749 "Survey speed dropped significantly during exposure (60 down to below 30%) due to variable image quality probably due to rising wind speed"

EXPID: 185442 "conditions got worse midway, including wind shake, and the exposure was manually interrupted"

These examples show different wind-related impacts: significant wind shake causing elongated guider images, reduced survey speed, need to split exposures, and sometimes compounding effects with other weather conditions.

All the computed metrics and analysis code are available at https://github.com/forero/wind_effects, and the enhanced exposure data is saved in 'expanded_exposures_info.ecsv'.

Attached is a plot that shows the typical distribution of wind speed and wind/telescope opening angle.

summary_2d.1.jpg (view on web) https://github.com/user-attachments/assets/fb97ded9-ee8b-4e28-93c9-9505e37c22ee

— Reply to this email directly, view it on GitHub https://github.com/desihub/desisurveyops/issues/241#issuecomment-2442769859, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQCCATALF3JSETQ2OWH35LZ52Y7XAVCNFSM6AAAAABQPGTWZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBSG43DSOBVHE . You are receiving this because you were mentioned.Message ID: @.***>

dkirkby commented 4 weeks ago

An undergrad Andy Park working with me looked at the wind impact on PSF shape in 2021. Slides from a presentation he gave are in DESI-6221.

sybenzvi commented 4 weeks ago

Thanks for posting Andy's presentation @dkirkby. Since Jaime finds that 10% of the exposures with a wind shake alarm were actually logged, a logical next step would be to compare the wind shake to the shapes of the guide images and look for correlations. Is it easy to check the ellipticity measurements that Andy reported in this study given what's in the database, or would those fits need to be redone?

dkirkby commented 4 weeks ago

The ellipticity measurements would need to be redone.

crockosi commented 4 weeks ago

Thanks for posting Andy's slides, David. That's a really nice analysis.

It's possible the off-line guider data analysis has ellipticies -- I think that is one of the outputs of Aaron's pipeline. That might be a source of those measurements.

--Connie

On Tue, Oct 29, 2024 at 10:26 AM David Kirkby @.***> wrote:

The ellipticity measurements would need to be redone.

— Reply to this email directly, view it on GitHub https://github.com/desihub/desisurveyops/issues/241#issuecomment-2444915715, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQCCATUGJKYCDNGQPR5N4TZ57AODAVCNFSM6AAAAABQPGTWZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBUHEYTKNZRGU . You are receiving this because you were mentioned.Message ID: @.***>

forero commented 3 weeks ago

Thanks for all the questions.

Answering @crockosi 's questions one by one

Is it possible to combine the dark and bright data to get a better look at the shape of the distribution in those plots of the "with wind events"? Or are the metrics different enough that isn't wise?

The metrics aren't significantly different. Here is the plot for the combined data

summary_2d_no_backup

forero commented 3 weeks ago

Do you know what is going on when we get wind shake or gust warnings when the wind is 10 mph and we are pointing at an opening angle of 140 degrees? I am surprised to see those.

One important thing to note is that the wind speeds and opening angles shown in the plots are averages over each exposure's time window. For instance, if we have a 20-minute exposure, I collect all wind measurements within those 20 minutes and compute their average. This means that even if the average wind speed is low (10 mph) and the average opening angle is large (140 degrees), there might have been brief periods with stronger winds or different angles that triggered the wind/shake warnings.

I still need to examine the detailed time series within these specific exposures to understand exactly what's happening in these cases.

forero commented 3 weeks ago

It would also be interesting to know if the distribution of wind speeds in the plots without wind events (maybe for opening angles > 90) looks the same as in the full set of wind measurement data?

Looking at the cumulative distributions, we can compare all exposures (blue solid line, n=13123) against exposures with no wind events and high opening angles (>90°) (red dashed line, n=4675). While these distributions are statistically different (according to the KS test), the practical difference is small: for any given wind speed, the difference in cumulative fraction between the two distributions is typically just a few mph. wind_distributions

forero commented 3 weeks ago

What is the ratio of the fraction of exposures at opening angle < 60 degrees in the wind vs. no wind data, and is that correlated with anything like wind direction or pointing azimuth? i.e., are there some conditions when we can point into the wind and mostly not get wind shake?

I found that approximately 45% of exposures with wind events have small opening angles (<60°), while only about 25% of exposures without wind events have such small angles. This means we are about 1.85 times more likely to get wind events when pointing close to the wind direction.

However, looking at the conditions where we can successfully point into the wind (opening angles <60° without wind events), I find the best results when:

  1. Wind comes from the 200-360 degree direction
  2. Wind speeds are below 10mph

This suggests there might be some directional effects that make certain wind directions less problematic, even when pointing close to the wind direction.

full_analysis_small_opening_angle

forero commented 3 weeks ago

What would be the best way to look at the off-line guider data analysis? Are there existing scripts I could use as starting points for this analysis?

forero commented 2 weeks ago

Do you know what is going on when we get wind shake or gust warnings when the wind is 10 mph and we are pointing at an opening angle of 140 degrees? I am surprised to see those.

I took a look at exposures around 10mph and 140deg opening angle (found 12 of those in a window of ±5 degrees and ±5mph). Looking at the time series plots, it's clear that these average values mask significant variability in the actual conditions.

EXPID 131965 is a perfect example. The wind direction and resulting opening angle show large swings of over 60 degrees during the exposure. Similarly, EXPID 118784 shows another interesting pattern where the wind speed suddenly jumps from near zero to almost 20 mph during the exposure.

expid_131965_timeseries

expid_118784_timeseries

crockosi commented 2 weeks ago

Thanks for all this, Jamie. The plots are great!

The fact that the distribution of wind speeds are so similar for the set of exposures with and without wind shake events is really interesting. That means the probability of getting a wind-shake event has the same dependence on wind speed regardless of opening angle. I would not have guessed that.

Looking at your plots of the distribution of opening angle vs. wind speed for both wind shake vs non-windshake events here https://github-production-user-asset-6210df.s3.amazonaws.com/1848618/382058505-1012e6aa-3a38-4778-8601-7638b4b43689.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20241113%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241113T211504Z&X-Amz-Expires=300&X-Amz-Signature=cde1a634ff2ea5e4fe662a785d6db7b035086f5406dcf94d0700d3222c8a6bf0&X-Amz-SignedHeaders=host, if you collapse both plots to a cumulative distribution vs. opening angle we get the probability of having a wind-shake event vs. opening angle. I think if we combine that with some knowledge of the distribution of wind directions and speeds (probably vs. month of the year, given seasonal variations) we have something we could use for simulating the effect on the survey.

We could refine that by correlating windshake events with the guider PSF diagnostics from the off-line processing. I looked for the guider processing outputs at NERSC before I wrote that last email and failed to find them but I expect several of the people on this thread know where to find them and I hope they will chime in.

Your observation about variation of opening angle and wind speed is cool. I guess one thing to explore is if we are more likely to have a wind shake event if there is a lot of variation in either wind speed or opening angle over an exposure (at fixed average wind speed and opening angle). That might change the probabilities in a way we should account for.

Again, thanks for all this. I think we are getting to what we need.

--Connie

On Mon, Nov 11, 2024 at 12:10 PM Jaime Forero-Romero < @.***> wrote:

Do you know what is going on when we get wind shake or gust warnings when the wind is 10 mph and we are pointing at an opening angle of 140 degrees? I am surprised to see those.

I took a look at exposures around 10mph and 140deg opening angle (found 12 of those in a window of ±5 degrees and ±5mph). Looking at the time series plots, it's clear that these average values mask significant variability in the actual conditions.

EXPID 131965 is a perfect example. The wind direction and resulting opening angle show large swings of over 60 degrees during the exposure. Similarly, EXPID 118784 shows another interesting pattern where the wind speed suddenly jumps from near zero to almost 20 mph during the exposure.

expid_131965_timeseries.jpg (view on web) https://github.com/user-attachments/assets/1a1e4ccd-3ce4-4397-bea1-d18bf26ab1e6

expid_118784_timeseries.jpg (view on web) https://github.com/user-attachments/assets/34b5b034-9850-40c3-88d5-9e7aec9f0c48

— Reply to this email directly, view it on GitHub https://github.com/desihub/desisurveyops/issues/241#issuecomment-2468944637, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQCCAVOCKL3OGA547H6NA32AEFM7AVCNFSM6AAAAABQPGTWZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRYHE2DINRTG4 . You are receiving this because you were mentioned.Message ID: @.***>

forero commented 1 week ago

Just to confirm that the opening angle is one of the most relevant variables, I performed one more test to assess the relative importance of the available variables in predicting whether an exposure will have gust/shake events (using random forest classification).

The opening angle turns out to be the second most important variable, while the most important one is the variability in the gust values (GUST_STD).

feature_importance

forero commented 1 week ago

Today we received many useful pointers!

From Stephen

offline GFA data analysis is in /global/cfs/cdirs/desi/survey/GFA/offline_matched_coadd_ccds_main-thru_20241117.fits; there is normally a new file each day that supersedes the previous file. The pipeline just propagates a few numbers for those files into the headers, so I'm not familiar with the details of what is in there.

From Ben: The location of the PR with the (still pending) data model for the offline GFA data https://github.com/desihub/desidatamodel/pull/202

From Anand:

for reference, this page hopefully has description of most of the columns: https://desi.lbl.gov/trac/wiki/SurveyValidation/SV1/conditions/summary_files.

From Ashley: Notebook to handle offline GFA data: https://github.com/desihub/LSS/blob/main/Sandbox/exp-conditionstable-locidcoadd.ipynb

Thanks!

araichoor commented 1 week ago

hi @forero,

sorry I ve not followed all your work here, but in case, if useful:

ashleyjross commented 1 week ago

What Anand posted likely correctly gives you what you need, but I finally found this script:https://github.com/desihub/LSS/blob/main/scripts/get_speccon.py , which is a bit enhanced compared to the notebook, so I'm sharing it in case it is helpful.