Git Product home page Git Product logo

Comments (8)

lawrenceccheung avatar lawrenceccheung commented on July 20, 2024 1

Hi @AsimUdel

There shouldn't be any changes you need to make to the AMR-Wind input file itself. The sampling output files should be viewable in any environment that can load netcdf files, and if you can view them through the amr-wind-frontend GUI, then it ought to be possible to plot them in a jupyter notebook.

One thing that you can try is using a notebook like this one to visualize the sampling00000.nc:
https://github.com/lawrenceccheung/ALCC_Frontier_WindFarm/blob/main/precursor/MedWS_LowTI/postprocessing/HubHeight_Viz.ipynb
This one might be a little more lightweight notebook, and doesn't require loading the full amr-wind-frontend library in order for it to work.

Let me know if you have any questions about how to use it, or if you run into any issues loading it.

Lawrence

from amr-wind.

AsimUdel avatar AsimUdel commented on July 20, 2024

Hi @lawrenceccheung
Thank you so much, I have tried opening in Python using Jupyter notebook, I have come up with some error, Let me attach the file containing error, maybe I am doing something w
error_while_opening_netcdf_file.txt
rong. I would be grateful if you could guide me how to use https://github.com/lawrenceccheung/ALCC_Frontier_WindFarm/blob/main/precursor/MedWS_LowTI/postprocessing/HubHeight_Viz.ipynb this file.

from amr-wind.

lawrenceccheung avatar lawrenceccheung commented on July 20, 2024

Hi @AsimUdel,

In the part of your script where you calculate the horizontal velocity

>>> iplane=1
>>> Uh=np.sqrt(db['velocityx'][0][iplane,:,:]**2)

set iplane=0. You only have one plane defined for xyplane, so that's why this error message appears:

IndexError: index 1 is out of bounds for axis 0 with size 1

Note that you have both the xyplane and yz contained in sampling00000.nc. By default, getPlaneXY() will extract the first plane that it sees (xyplane). To get the other plane, use the groupname option:

db     = ppsamplexr.getPlaneXR(amrdir+ncfile, iters, varnames, groupname='yz', verbose=0)

Lawrence

from amr-wind.

rybchuk avatar rybchuk commented on July 20, 2024

If you're using xarray, you will often have to specify the group variable when running xr.open_dataset. Below I've attached a screenshot of some code where I ran 6 different spinup simulations (I was trying different roughness and surface flux heat values), and you can see how I open the netCDF data of each of those simulations and concatenate them. I end up with two Datasets in the end: one for the profile variables (pstats) and one for the other variables.

image

from amr-wind.

AsimUdel avatar AsimUdel commented on July 20, 2024

@lawrenceccheung
I have tried as you suggested, I have attached screenshot of the Jupyter notebook and output of sampling00000.nc by GUI (AMR-Wind-Frontend), I don't know how to access the variable using Jupyter notebook
my planes input files are
yz_-2D ,yz_-4D, yz_0D, yz_2D, yz_4D, yz_6D, yz_8D
xy_hub xy_rotor_top xy_rotor_bottom
Kindly suggest me how to see the list of variables and shape so that I can plot them.
Output_by_GUI
error_python_opening

from amr-wind.

lawrenceccheung avatar lawrenceccheung commented on July 20, 2024

hi @AsimUdel, in your case use

Uh = np.sqrt(db['velocityx'][2][iplane,:,:]**2)

In that last cell.

The dictionary that is returned by ppsamplexr.getPlaneXR() has the following structure:

db[varkey][iterkey][planenum, i, j]

where:

  • varkey corresponds to the variable name (in your case velocityx)
  • iterkey corresponds to the time instance of the plane. In your case, you only extracted the slice corresponding iterkey=2 because you specified iters=[2] above.
  • planenum is the offset plane number of the sample plane. In all cases you will have planenum=0 present, and if in the input file you provide. If you used the offsets specification in the input file, like in this example:
turbswA_.T0_swA.type                     = PlaneSampler        
turbswA_.T0_swA.num_points               = 601 45              
turbswA_.T0_swA.origin                   = 730.0 2560.0 0.08400000000000318
turbswA_.T0_swA.axis1                    = 3810.0 0.0 0.0      
turbswA_.T0_swA.axis2                    = 0.0 0.0 280.416     
turbswA_.T0_swA.normal                   = -0.0 1.0 -0.0       
turbswA_.T0_swA.offsets                  = 0.0 254.0 508.0     

you can specify planenum=1 or 2 as well.

  • i and j are the x and y indices of the plane that will be used to plot.

Hope this helps.

Lawrence

from amr-wind.

AsimUdel avatar AsimUdel commented on July 20, 2024

@lawrenceccheung
Thank you so much for comprehensive guide, right now I have plotted it.
new_amr

from amr-wind.

AsimUdel avatar AsimUdel commented on July 20, 2024

If you're using xarray, you will often have to specify the group variable when running xr.open_dataset. Below I've attached a screenshot of some code where I ran 6 different spinup simulations (I was trying different roughness and surface flux heat values), and you can see how I open the netCDF data of each of those simulations and concatenate them. I end up with two Datasets in the end: one for the profile variables (pstats) and one for the other variables.

image

@rybchuk
Thank you so much, I will definitely look into that as (there must be many output files), I will try and get back to you soon.

from amr-wind.

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.