MHKiT-Software / MHKiT-Python

MHKiT-Python provides the marine renewable energy (MRE) community tools for data processing, visualization, quality control, resource assessment, and device performance.
https://mhkit-software.github.io/MHKiT/
BSD 3-Clause "New" or "Revised" License
47 stars 45 forks source link

Convert wave module to xarray #302

Closed akeeste closed 2 months ago

akeeste commented 2 months ago

This PR converts the wave module to be based in xarray.

TODO list

Modules completed:

akeeste commented 2 months ago

At long last... (kind of, a little more work to go)

@ssolson I still have a bit more work that I will push before I'm on travel. Fortunately I was able to get most of my previous work on the wave module working smoothly and that is included here. My goal before travel is to finish adding xarray IO to each function for the wave.io module and make sure all of the current tests are passing. I may need your help adding some tests using xarray. Will update further in a day or two

akeeste commented 2 months ago

@ssolson I addressed all of you review comments. Let me know if you have any other feedback on this PR

akeeste commented 2 months ago

I merged develop into this branch. The linting test should pass now

akeeste commented 2 months ago

Not sure why the power linting tests are still failing. The only change to the power module is fixing an TypeError in power.quality. I can address the one linting suggestion for power.characteristics easily enough, but I'm unsure why this is failing here and now.

ssolson commented 2 months ago

@akeeste I was testing the examples and the cdip example is failing for me. This is unreleated to your changes. I am running py 3.11 on windows. Can you tell me if you are getting a similar error: image

I believe the fix for this on 267 is:

start_date = datetime.datetime.strptime(start_date, "%Y-%m-%d")
start_date = start_date.replace(tzinfo=pytz.UTC)

then the same for end date on 278.

akeeste commented 2 months ago

@ssolson Thanks for the reminder, I'm glad you caught that. I did see this warning recently when running the CDIP example outside of this PR. I agree that your fix should work; I'll add a commit

akeeste commented 2 months ago

Hey @ssolson I caught one last thing. The wave.io.hindcast.wind_toolkit function needs a parameter to convert data to xarray instead of pandas. I'll add this quickly today, then we can merge this PR. That should completely round out xarray IO for all of our functions