Skip to content

Fix AMR-Wind reader, datetime64 DEL, EmptyFileError and pdf_histogram - #92

Open
adzetto wants to merge 5 commits into
OpenFAST:mainfrom
adzetto:fix-small-bugs
Open

adzetto wants to merge 5 commits into
OpenFAST:mainfrom
adzetto:fix-small-bugs

Conversation

@adzetto

@adzetto adzetto commented Nov 30, 2026 •

Copy link
Copy Markdown

Small fixes, one commit each.

AMRWindFile.read used an undefined filename and os was not imported, so AMRWindFile and TurbSimFile.fromAMRWind always raised NameError. fromAMRWind also ignored fileout and wrote to .nc.bts (the input extension plus .bts).

With that fixed, the reader still put values at the wrong coordinates. AMR-Wind writes plane points with axis1 varying fastest (PlaneSampler::sampling_locations), but read() reshaped them as if z did, so with the usual axis1 along y the y and z data were swapped. fromAMRWind swapped them back, which only worked for square planes and crashed otherwise (could not broadcast input array from shape (5,3,5) into shape (5,5,3) for a 5x3 plane). read() now places each point by its coordinates, so any plane shape and axis order works, and a rotated plane gives a clear ValueError. timestep is optional now (dt comes from the time variable in the file), and fromAMRWind lets hubValues compute uRef like the other converters, so y=0 and zref no longer have to be grid points.

equivalent_load returned nan for datetime64 time because T was used before assignment. The corner case test expected that nan; it now checks that datetime64 gives the same result as the same span in seconds.

fast_input_file raised NameError instead of EmptyFileError for an empty file, and pdf_histogram(count=True) used an undefined n; it now divides by the number of samples in the histogram.

Tested with synthetic AMR-Wind files written in PlaneSampler order: y-z planes of 7x4, 4x7 (axis1 along z), 5x5 and 6x3 with three x offsets, and a horizontal plane all read back exactly, and the .bts written by fromAMRWind round trips. The test suite has the same 11 failures as main (pandas 3, which #90 fixes).

filename and os were undefined, and fileout was replaced by the input extension plus .bts.
T was used before assignment, so it returned nan.
Copilot AI balanced review requested due to automatic review settings November 30, 2026 11:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

AMR-Wind writes plane points with axis1 fastest, but read() reshaped them as if z were. Place each point by its coordinates, take dt from the file when timestep is not given, and let hubValues compute uRef.
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.

2 participants