Velocerऐप खोलें

Velocer › फ़्लैशकार्ड › University of Wisconsin–Madison › AOS 573: Computational Methods · UW-Madison

AOS 573: Computational Methods · UW-Madison

Made these while studying for AOS 573. covers most of what we went over in lecture. · quiet_kernel द्वारा · 103 कार्ड्स

University of Wisconsin–Madison

इस डेक का अध्ययन करें एम्बेड करें

  1. What does the Git rebase workflow accomplish?It integrates changes from one branch into another by reapplying commits, producing a clean, linear history.
  2. Why are area-weighted global means necessary for gridded climate data?Grid cells vary in area (especially with latitude), so weighting by cell area avoids bias in global averages.
  3. What is cmocean used for?Providing perceptually uniform colormaps designed for oceanographic and atmospheric data.
  4. What does xarray provide for climate data analysis?Labeled multidimensional arrays that make working with NetCDF gridded datasets easier.
  5. What is the difference between tabular and gridded data in this context?Tabular data is organized in rows/columns (e.g., cruise measurements, indices), while gridded data is multidimensional arrays on a spatial grid (e.g., NetCDF climate fields).
  6. What is the main benefit of using git pull --rebase instead of a regular pull?It maintains a clean linear history without creating merge commits.
  7. What should you do with local changes before running git pull --rebase?Stage and commit them first, so your work can be replayed on top of upstream updates.
  8. What does rebasing do with your local commits during a pull?It replays them on top of the updated upstream branch rather than merging the two histories.
  9. What is the data hygiene rule regarding large binary datasets in Git?Never commit or push them to Git repositories; keep them in shared storage or exclude them via .gitignore.
  10. How can you prevent large dataset files from being tracked by Git?Add them to .gitignore or keep them in shared storage outside the repository.
  11. Why is committing large binary datasets to Git problematic?They bloat the repository and should instead live in shared storage or be ignored via .gitignore.
  12. What history structure results from using git pull --rebase?A clean, linear history with no merge commits.
  13. What file is used to define a reproducible conda environment?An environment.yml file, which specifies the channels and pinned dependencies for the environment.
  14. Which channel should be listed in environment.yml to use conda-forge packages?channels: [conda-forge]
  15. How are dependencies specified in an environment.yml file?Under dependencies: as a list, with versions optionally pinned (e.g., python=3.12, numpy>=1.19).
  16. What does pinning a dependency version like python=3.12 accomplish?It locks that package to a specific version, helping ensure the environment is reproducible across machines.
  17. Why should you export only explicitly requested packages rather than all installed packages?To omit OS-specific transitive build hashes, keeping the environment file portable and reproducible across platforms.
  18. What problem do OS-specific transitive build hashes cause when exporting environments?They make the exported environment file platform-dependent and non-portable, so they should be excluded.
  19. What is the benefit of defining environments in an environment.yml file?It makes environments reproducible, so the same package set can be recreated consistently on other systems.
  20. What is the purpose of the channels key in environment.yml?It specifies which package repositories conda should search, such as conda-forge.
  21. What does the == operator test in Python?It tests whether two objects have equal values.
  22. What does the is operator test in Python?It tests whether two variables point to the exact same memory address (i.e., id(a) == id(b)).
  23. If a = [1,2,3] and b = [1,2,3], what are the results of a == b and a is b?a == b is True (equal values), but a is b is False (different objects in memory).
  24. What happens to a when you do b = a; b.append(4)?a is also mutated, because b is an alias pointing to the same list object.
  25. How do you make an independent copy of a list a?Use b = a.copy() so mutations to b do not affect a.
  26. Why are sentinel fill values like -99 or -9999.0 dangerous in observational datasets?If not replaced with np.nan before computing statistics, they severely bias results (e.g., pull means downward).
  27. Why does x == np.nan fail to detect missing values?Because x == np.nan is always False; use np.isnan(x) or np.isfinite(x) instead.
  28. Which NumPy functions detect NaN values?np.isnan(x) and np.isfinite(x).
  29. Which NumPy functions perform NaN-safe aggregations?np.nanmean() and np.nanstd() (and similar np.nan* functions).
  30. What is the difference between value equality and object identity?Value equality (==) compares contents/values; object identity (is) compares whether both references point to the same memory address.
  31. Why are NumPy vectorized operations like np.dot or @ faster than Python for loops?They call pre-compiled C/Fortran BLAS routines, making them roughly 10x-100x faster than pure Python for loops.
  32. In a 2D array with shape (rows, cols), what does axis=0 mean?axis=0 collapses across rows, operating down each column (e.g., a depth-averaged profile at each latitude).
  33. In a 2D array with shape (rows, cols), what does axis=1 mean?axis=1 collapses across columns, operating across each row (e.g., a meridional mean across latitudes at each depth).
  34. State the NumPy broadcasting rule for elementwise operations.Comparing trailing dimensions right-to-left, dimensions are compatible when they are equal or one of them is 1.
  35. How does broadcasting let you multiply temperature T of shape (2, 3) by a depth vector D of shape (2, 1)?D is broadcast across all 3 latitudes, so each depth value scales the row of temperatures at that depth.
  36. Given T of shape (2, 3) (depth, lat) and D of shape (2, 1), what does (T * D).mean(axis=1) produce?A 2-element array giving the meridional mean at each depth.
  37. What is the convention for plotting ocean pressure or depth on a profile plot?Plot depth/pressure on the y-axis with the axis inverted so values increase downward (ax.invert_yaxis() or ax.set_ylim(p_max, 0)).
  38. What is a T–S diagram used for in oceanography?A scatter plot of temperature vs. salinity used to identify water masses.
  39. Which NumPy functions perform fast matrix multiplication via BLAS?np.dot(a, b), np.matmul(A, B), and the @ operator.
  40. What does axis=0 produce when applied to a 2D (depth, lat) array?A depth-averaged profile at each latitude (collapsing across rows).
  41. What does axis=1 produce when applied to a 2D (depth, lat) array?A meridional mean across latitudes at each depth (collapsing across columns).
  42. What tool is mentioned for timing NumPy operations against Python loops?%timeit.
  43. When broadcasting two arrays, which dimensions are compared and in what order?Trailing dimensions are compared right-to-left.
  44. What happens when a compared dimension is 1 during broadcasting?That dimension is stretched to match the other array's size.
  45. What does the pandas expression df.where(df != -9999.0, np.nan) do?It replaces every occurrence of the sentinel value -9999.0 with NaN while preserving all valid entries.
  46. Why should you filter by quality flags and exclude NaNs before computing sample percentages?Because interpolated, missing, or NaN values would distort the percentages; only valid measurements should be counted.
  47. How do you count distinct geographic sampling stations in a DataFrame?Use df.drop_duplicates(subset=['latitude', 'longitude']).shape[0].
  48. How do you read a CSV with nested (hierarchical) column headers in pandas?Pass header=[0, 1] to pd.read_csv, which creates a MultiIndex for the columns.
  49. How can you aggregate across sub-levels of a MultiIndex table?Transpose the table or specify level=0 in .groupby().
  50. What is the difference between wide-form and long-form (tidy) data?Wide-form has values spread across columns (e.g., months JAN–DEC), while long-form has one observation per row (e.g., Year, Month, Anomaly).
  51. Which data form is required by seaborn relational and categorical plots like lineplot, boxplot, and jointplot?Long-form (tidy) data, where each row is a single observation.
  52. What is wide-form data well suited for in seaborn?Compact visualizations like heatmaps, e.g., sns.heatmap(df_wide.T).
  53. How do you convert wide-form data to long-form with pandas?Use pd.melt(df.reset_index(), id_vars=['YEAR'], var_name='Month', value_name='Anomaly').
  54. What does the usecols argument do in pd.read_csv?It selectively loads only the specified columns from the file.
  55. What does the index_col argument do in pd.read_csv?It sets the specified column as the DataFrame's index.
  56. What does the id_vars parameter do in pd.melt?It specifies the columns to keep as identifier variables (not unpivoted) during reshaping.
  57. What do the var_name and value_name parameters do in pd.melt?var_name names the column holding the former wide column labels, and value_name names the column holding the values.
  58. Why is df.reset_index() often called before pd.melt?Because melt cannot use the index as an identifier variable, so the index must be turned into a column first.
  59. What are the Lorenz equations?A simplified model of atmospheric convection rolls: ẋ = σ(y − x), ẏ = r x − y − x z, ż = x y − b z, with Prandtl number σ, Rayleigh number r, and geometric factor b.
  60. What parameter values produce the classic chaotic butterfly attractor in the Lorenz system?σ = 10, r = 28, b = 8/3.
  61. What do the Lorenz parameters σ, r, and b represent?σ is the Prandtl number, r is the Rayleigh number, and b is a geometric factor.
  62. Which numerical method is used to integrate the Lorenz equations in the section?Runge–Kutta 4/5 via scipy.integrate.solve_ivp.
  63. Why must unevenly spaced paleoclimate time series be interpolated before filtering or FFT analysis?Digital filters and FFTs strictly require uniform sample spacing Δt, but ice-core gas ages are unevenly spaced due to ice compaction.
  64. What is the Nyquist frequency formula for a uniform grid with spacing Δt?f_Nyq = 1 / (2 Δt).
  65. How do you apply a Butterworth low-pass filter to retain periods longer than 25 kyr?Normalize the cutoff frequency f_c = 1/25 kyr⁻¹ by the Nyquist frequency, then apply zero-phase filtering with scipy.signal.filtfilt(b, a, y_interp).
  66. Why should a time series be linearly detrended before taking an FFT?To prevent secular trends and zero-frequency leakage from swamping the spectral peaks.
  67. How are frequencies and positive-frequency power computed after an FFT?Use freqs = scipy.fft.fftfreq(N, d=dt) and take |fft(y)[:N//2]| for positive-frequency power/amplitude.
  68. What does xr.open_dataset() do?Loads a single NetCDF file into an xarray Dataset object.
  69. What does xr.open_mfdataset() do?Loads multiple NetCDF files matching a glob pattern into a single combined Dataset.
  70. What is the purpose of the combine='by_coords' argument in open_mfdataset?It combines multiple files by aligning them along their coordinate values.
  71. How do you materialize a lazily loaded Dask-backed xarray Dataset into memory?Call .load() or .compute() on the Dataset.
  72. What is the difference between .sel() and .isel() in xarray?.sel() selects by coordinate value (e.g., depth=0), while .isel() selects by integer position (e.g., time=0).
  73. How would you select depth 0 and latitudes between -30 and 30 using coordinate-aware indexing?ds.sel(depth=0, lat=slice(-30, 30))
  74. Why is crossing the dateline or prime meridian a problem for zonal means?Longitudes may not be contiguous (e.g., 120°E to 70°W), so averaging over longitude without reordering gives incorrect results.
  75. How can you make longitudes contiguous across the dateline before taking a zonal mean?Use ds.roll(lon=..., roll_coords=True) or xr.concat() to reorder longitudes so they span contiguously.
  76. How do you compute a climatological anomaly for a variable like PRECTOT?Subtract the time mean: anom = ds['PRECTOT'] - ds['PRECTOT'].mean(dim='time').
  77. What does roll_coords=True do in ds.roll()?It rolls the coordinate values along with the data so coordinates stay aligned with the rolled data.
  78. Why do high-latitude grid cells have smaller physical area than equatorial cells on a regular latitude–longitude grid?Meridians converge toward the poles, so the east-west spacing between longitudes shrinks with latitude, reducing each cell's physical area.
  79. What is the formula for the east-west grid spacing Δx(φ) on a regular latitude–longitude grid?Δx(φ) = R_E cos(φ) Δλ, where φ and λ are in radians.
  80. What is the formula for the north-south grid spacing Δy?Δy = R_E Δφ, with Δφ in radians.
  81. What is the physical area of a grid cell at latitude φ and longitude λ?Area(φ, λ) = R_E² cos(φ) Δφ Δλ, with angles in radians.
  82. What units must latitude and longitude be in when computing cos(φ) and cell areas?Radians; convert degrees with np.deg2rad(lat).
  83. How do you compute an area-weighted global mean in xarray?Multiply the field by cos(φ) (or by cell area) as weights and take the weighted mean, e.g. using .weighted(weights).mean().
  84. Why is a simple arithmetic mean of grid-cell values biased on a latitude–longitude grid?Cells at high latitudes represent less physical area, so an unweighted mean over-represents polar regions relative to their true area.
  85. What weighting factor is commonly used for global means on a regular lat–lon grid?cos(φ), the cosine of latitude, which is proportional to cell area (the Δφ Δλ and R_E² factors cancel in a weighted mean).
  86. How do you convert precipitation flux to a total mass rate per grid cell?Multiply the flux at each cell by that cell's physical area in m², giving kg s⁻¹.
  87. What is the unit of the total mass rate obtained after multiplying flux by cell area?kg s⁻¹.
  88. What is the physical meaning of multiplying a flux by grid-cell area?It integrates the flux over the cell, converting a per-area rate into a total rate for that cell.
  89. How would you compute the global total precipitation mass rate from gridded flux?Multiply each cell's flux by its area R_E² cos(φ) Δφ Δλ and sum over all cells.
  90. What happens to the cos(φ) weighting factor when computing a weighted global mean rather than a total?It cancels with the constant Δφ Δλ and R_E² factors, so cos(φ) alone can serve as the weight.
  91. In the area formula, what do Δφ and Δλ represent?The grid spacing in latitude and longitude, respectively, expressed in radians.
  92. In Cartopy, what does the projection argument in subplot_kw={'projection': ...} control?It sets the target map projection of the axes (how the map is drawn).
  93. In Cartopy, what does the transform argument inside a plotting call like ax.contourf(...) specify?It tells Cartopy which coordinate system the input data arrays are defined in.
  94. What is the difference between projection and transform in Cartopy plotting?projection sets the target map projection of the axes, while transform declares the coordinate system of the input data arrays.
  95. How do you fix the white seam at the dateline when contour-plotting global data in Cartopy?Use data_cyc, lon_cyc = cartopy.util.add_cyclic_point(data, coord=lon) before calling contourf.
  96. What does cartopy.util.add_cyclic_point do?It adds a cyclic point to the data (and longitude coordinate) so plots wrap seamlessly across the dateline, removing the white seam.
  97. Which type of colormap should be used for magnitude data such as cmocean's thermal, haline, or viridis?Sequential perceptually uniform colormaps.
  98. Which type of colormap should be used for anomalies, and why?Diverging colormaps centered at zero (e.g., cmo.balance, cmo.curl, RdBu_r), because they emphasize deviation in two directions from a midpoint.
  99. What is a perceptually uniform colormap?A colormap where equal steps in data values produce roughly equal perceived changes in color, avoiding misleading visual artifacts.
  100. Why prefer perceptually uniform colormaps over non-uniform ones like jet?They represent data magnitudes faithfully and avoid false boundaries or misleading emphasis created by uneven perceptual steps.
  101. In ccrs.Mollweide(central_longitude=-160), what does central_longitude control?It sets the longitude placed at the center of the Mollweide projection.
  102. When plotting with Cartopy, what coordinate system does ccrs.PlateCarree() represent?A simple longitude/latitude (equirectangular) coordinate system commonly used for input data arrays.
  103. What must you specify when your data arrays are in lon/lat but the axes use a different projection?Pass transform=ccrs.PlateCarree() (or the appropriate CRS) to the plotting call so Cartopy reprojects the data correctly.

Velocer मुफ़्त है: स्पेस्ड रिपिटिशन और किसी भी दस्तावेज़ से अपने खुद के कार्ड।

PDF to flashcards · Lecture to flashcards · Practice exam · Syllabus study plan · Anki import

University of Wisconsin–Madison के और डेक