GithubHelp home page GithubHelp logo

Comments (3)

mvremec avatar mvremec commented on June 1, 2024

Hi @Engel23,
Thank you for raising this issue.

Based on your description, it seems that the name of your DataArray's ("yourDataArray") time dimension is neither "time" or "index".

  1. You can check whether this is the case with:
    yourDataArray.dims
    It should return something like "({'time': 3672, 'y': 17, 'x': 20})" or "({'time': 3672, 'latitude': 17, 'longitude': 20})". If it does not return 'time', you can fix this by changing the current name of the time dimension (for example, let's call it "timeindex"):
    newDataArray = yourDataArray.rename_dims({"timeindex":"time"})
    You should now be able to check the time dimension of the "newDataArray" with:
    newDataArray.time
    It should return an array with a dtype = 'datetime64[ns]'
    You should now be able to use "newDataArray" with PyEt.

I hope this answer solves your question. Please let me know!
Is the CMIP6 data publicly available? If so, I can create an example using a subset of the data.

Best, Matevz


Why did this probably happen?
In the FAO-56 method, the Day of the year (DOY) is needed to compute extraterrestrial radiation. In PyEt, DOY is obtained from the time dimension of the input Pandas.Series or xarray.DataArray. We have designed PyEt with an assumption that the xarray.DataArray time dimension is called "time" or "index". This is usually the case; however, there might be exceptions. That's why it's good to communicate on such issues. Thank you for that!

How to solve this in future versionsof PyEt?
Add a function that raises an error if the name of the time dimension in xarray.DataArray is not "time".
#43

from pyet.

Engel23 avatar Engel23 commented on June 1, 2024

Hi @mvremec,
Thank you for your quick response and for your help, the dimension name was indeed where it went wrong since my dimension had a different name due to prior calculations. The pm-fao56 method seems to work now for my data! The CMIP6 data is publicly available here (https://esgf-node.llnl.gov/search/cmip6/), note that the variables needed for the pyet package (tasmax, tasmin, etc) are distributed into different netcdf files.

Again thank you for your help!
Best, Engel

from pyet.

mvremec avatar mvremec commented on June 1, 2024

Hi @Engel23,
I am very glad to hear that.
I have added an example with CMIP6 data I downloaded from Copernicus (https://cds.climate.copernicus.eu/) and will probably extend it to the data from your link. Thank you for that!
Example 9: https://github.com/pyet-org/pyet/blob/dev/examples/09_CMIP6_data.ipynb

I wish you lots of fun and exciting work with PyEt!
Best,
Matevz

from pyet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.