rainymotion icon indicating copy to clipboard operation
rainymotion copied to clipboard

more api / examples plz !

Open ghost opened this issue 6 years ago • 6 comments

hi Georgy: I feel so excited on your Rainymotion project. I believe that it will give me great help in the field of nowcasting. However, I find it a little bit difficult in preparing suitable input data (as I am a raw hand of python and hdf5 format). Also, I have no idea in choosing the proper functions (i.e. SparseSD or Sparse?) in different conditions. Could you give a little bit more introduction in the following update of the upcoming tutorial(if there is a upcoming one)?

ghost avatar Mar 15 '19 09:03 ghost

Hi @IncubatorShokuhou, thank you for your interest in rainymotion!

rainymotion models require inputs in the form of 3D numpy array (frames, dim_x, dim_y) of radar data for previous timesteps where "frames" dimension must be > 2. After model initialization, you can attribute data to the model via model.input_data. Also, important to attribute Scaler which you think better suits for rainfall data conversion from intensities (or accumulation) to uint8 data type (which is the requirement for optical flow algorithms). You can set up Scaler via model.scaler. Maybe models' docstrings will be more helpful than the documentation (https://github.com/hydrogo/rainymotion/blob/master/rainymotion/models.py).

Thus, first of all, you have to find the way how to read your data to 3D numpy array, and then create a Scaler which fits your data the best (by default you can use our RY_Scaler, or try MinMaxScaler from the sklearn library).

As for the choice of different models we recommend you to try all of them on your data :-) For Germany, the Dense model works the best (see our paper for particular evaluation results).

At the moment, we focus on our paper revision and have no plans for an additional tutorial. If data you use is open, you can send us the link, and we will try our best to help you with preprocessing.

Best, Georgy

Our paper: Ayzel, G., Heistermann, M., and Winterrath, T.: Optical flow models as an open benchmark for radar-based precipitation nowcasting (rainymotion v0.1), Geosci. Model Dev. Discuss., https://doi.org/10.5194/gmd-2018-166, in review, 2018.

hydrogo avatar Mar 16 '19 10:03 hydrogo

Hi @IncubatorShokuhou

I already created an example to ilustrate how to use this library. Nevertheless, don't let be fooled by the example. I say this because data corresponds a light drizzly, so it's normal obtain bad results starting from this data. After all, I hope this example serve to you to fammiliarize with rainymotion

Example: https://github.com/ElmerJeanpierreLopez/nowcasting_examples/blob/master/Nowcasting_Rainymotion.ipynb

ElmerJeanpierreLopez avatar Oct 09 '19 13:10 ElmerJeanpierreLopez

Hi Elmer, thanks for yout example!! I have a question. When you rune the model, where are the results saved? In which format? Could you send me your input file?

Thanks you

Giovanni

GiovanniVignoli95 avatar Dec 03 '19 08:12 GiovanniVignoli95

Hi @GiovanniVignoli95

Results are not saved, model.run() returns an array-like that contains the predicted data. About the input file, it's available in the same repository. If you want to run the code, just change the file direction.

ElmerJeanpierreLopez avatar Dec 03 '19 13:12 ElmerJeanpierreLopez

Thanks you @ElmerJeanpierreLopez !! But if I want to reuse the output array, where do I find it? If I use (with Dense for example)

#import Dense

from rainymotion.models import Dense

model = Dense()

#enter the right path

model.input_data = h5py.File("..............", "r")

nowcast = model.run()

There are no error, but what do I get?

Thank Giovanni

GiovanniVignoli95 avatar Dec 03 '19 14:12 GiovanniVignoli95

Hello again @GiovanniVignoli95 You have a big mistake, because you need to pass an array-like with 3 dimentions and instead you pass an instance of the h5py class. So, your code, I guess doesn't work. As I said, you get an array like (object of numpy.ndarray). For the previous example, nowcast contains the output.

ElmerJeanpierreLopez avatar Dec 03 '19 14:12 ElmerJeanpierreLopez