Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples for subsetting STOFS outputs #16

Open
AtiehAlipour-NOAA opened this issue May 17, 2024 · 13 comments
Open

Add examples for subsetting STOFS outputs #16

AtiehAlipour-NOAA opened this issue May 17, 2024 · 13 comments
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@AtiehAlipour-NOAA
Copy link

Description

Add notebooks or example scripts for subsetting different STOFS outputs.

Below are example notebooks demonstrating how to subset the STOFS-3D-Atl data and visualize the resulting outputs:

https://github.com/AtiehAlipour-NOAA/Subsetting/blob/main/notebooks/KeyBridge_Visualization.ipynb
https://github.com/AtiehAlipour-NOAA/Subsetting/blob/main/notebooks/KeyBridge_multiple_files.ipynb

The goal is to provide examples that users can easily follow to subset data for their specific STOFS datasets of interest.

@mpiannucci mpiannucci added this to the GSOC 2024 milestone May 23, 2024
@mpiannucci mpiannucci added the documentation Improvements or additions to documentation label May 23, 2024
@mpiannucci
Copy link
Collaborator

@AtiehAlipour-NOAA
Copy link
Author

STOFS 2D example is now available here: https://github.com/asascience-open/xarray-subset-grid/blob/main/examples/stofs_2d.ipynb

@mpiannucci Thanks for the update. I will run the example code. Can we use the same code for fields.cwl.nc, fields.swl.nc, and fileds.htp.nc? Thanks!

@mpiannucci
Copy link
Collaborator

Yes the code would be the same for all of them assuming that they all have the same metadata. The 3D cases will require #20 tho so will revisit when that is done

@AtiehAlipour-NOAA
Copy link
Author

@mpiannucci and @omkar-334 @ChrisBarker-NOAA Thank you again for providing these amazing example codes for STOFS data. I was able to install the xarray-subset-grid package and use the STOFS-2D code to run a few examples. I have a few observations and suggestions:

  • The example code uses data from the _para2 folder, which is a development folder and not STOFS-2D-Global operational data. Please consider using data from the operational directory, for example: https://noaa-gestofs-pds.s3.amazonaws.com/stofs_2d_glo.20240807/stofs_2d_glo.t06z.fields.cwl.nc

  • Please add 'anam=true' to fs = fsspec.filesystem("s3"), otherwise, you will encounter a permission error.
    image

  • When I tested the code for subsetting "fields.swl.nc", I encountered the following error:

image

@AtiehAlipour-NOAA
Copy link
Author

@omkar-334, I was trying to test the STOFS-2D code and want to reuse the selector for an SWL file. Shouldn't this be ds_swl instead?

image

If so, when I change it to ds_swl, I get this error:

image

@AtiehAlipour-NOAA
Copy link
Author

@omkar-334, thanks for putting the STOFS example code together. I tried to run the STOFS-3D example with the operational data, but it doesn’t seem to be working as expected.

image
image

@omkar-334
Copy link
Contributor

omkar-334 commented Aug 29, 2024

I've tried it on the operational data. The dataset you've mentioned (s3://noaa-nos-stofs3d-pds/STOFS-3D-Atl/stofs_3d_atl.20240822/stofs_3d_atl.t12z.fields.temperature_f001_012.nc) does not recognize any grid type.
image
image

Making it CF compliant doesnt work because there is no face dimension or face_node_connectivity. Should we build it?

Moreover, the Select function assumes that we are going to reuse the selector for the same grid class , i.e, Ugrid->Ugrid, RegularGrid -> RegularGrid
image
The operational temperature data only contains self._node_dimension (which is nSCHISM_hgrid_node) out of all the parameters.
So, here the appropriate subset operation should be
image, which works.

Should we be checking if the parameters exist and accordingly apply the subset?

@omkar-334
Copy link
Contributor

omkar-334 commented Aug 29, 2024

For CWL -> SWL subsetting, the same issues occur.

Moreover, the Select function assumes that we are going to reuse the selector for the same grid class , i.e, Ugrid->Ugrid, RegularGrid -> RegularGrid

the CWL dataset is recognized as UGrid while the SWL is recognized as a RegularGrid. Both classes have different parameters and logic for the selector.

Making it CF compliant doesnt work because there is no face dimension or face_node_connectivity. Should we build it?

The SWL dataset doesn't have both face_node_connectivity and mesh_topology

@AtiehAlipour-NOAA
Copy link
Author

@omkar-334, thanks for looking into this. The spatial grids for CWL and SWL are the same, similar to the temperature and out2d files. Since node connectivity is missing in some of the files, the idea was to read this information from files that include it, such as CWL for STOFS-2D and out2d for STOFS-3D. My understanding was that this was an automatic process: when we first read CWL and out2d files, the selector would collect this information, use the node information, and subset the data accordingly.

@omkar-334
Copy link
Contributor

By Grid type , I meant the Grids we have implemented in our code. There are 4 sub classes for the Selector - UGrid, SGrid, RegularGrid, RegularGrid2d.

Each subclass has different logic and parameters.

@AtiehAlipour-NOAA
Copy link
Author

By Grid type , I meant the Grids we have implemented in our code. There are 4 sub classes for the Selector - UGrid, SGrid, RegularGrid, RegularGrid2d.

Each subclass has different logic and parameters.

@omkar-334, thanks for the clarification. Both CWL and SWL have ugrid type.

@omkar-334
Copy link
Contributor

@AtiehAlipour-NOAA Yes , you are right. I meant that even though both are UGrid, our code recognizes one as RegularGrid because of the missing connectivity

@AtiehAlipour-NOAA
Copy link
Author

Would it be possible to refine the selector so that when we use it on CWL, it considers the node connectivity of CWL for the next file (SWL)? Alternatively, could we use assign_ugid_topology to provide those information? @ChrisBarker-NOAA @mpiannucci do you have any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants