-
Notifications
You must be signed in to change notification settings - Fork 4
Updated version to work with spectral element files, and support for current CMIP7 time and bounds format #31
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
base: main
Are you sure you want to change the base?
Conversation
…g to more informative default output filenames
|
This one is what we ran with to get input-files for NorESM... @ckoven |
|
@maritsandstad thanks for the PR. Would you please point me to the spectral grid file (or an example) that you used in your case? |
|
So I had to make my own (using ESMF), happy to upload it somewhere. |
Thanks @maritsandstad; I just sent a link to a shared drive to your cicero account. |
| self.se_regridder = make_se_regridder(regridder_steptwo_weights, regrid_method=regrid_method) | ||
| intermediate_ds = ImportRegridTarget(intermediate_regridding_file) | ||
| #print(intermediate_ds) | ||
| self.step_one_regridder = xe.Regridder(ds_to_regrid, intermediate_ds, regrid_method) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maritsandstad can you describe the workflow for using the intermediate regridding target?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I wasn't able to coax ESMF into making a regridding file directly from 0.5by0.5 degree to the ne30 spectral resolution. Therefore, I needed to regrid from that to the regular grid I was able to get ESMF to make a file for regridding to spectral resolution for (0.9x1.25 degrees), and then I regrid over to the spectral grid from there using my map definition file (which I wasn't allowed to upload so far.) Not ideal, I guess. Do you want me to comment the code better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation @maritsandstad. Does the interstitial regular grid just need to be a grid close in resolution to the final spectral grid resolution? I'm not familiar with the nomeclature for the spectral grids; what's the 30 in ne30 refer to and what resolution in degrees is it close to?
Code comments are always welcome, but in this case I think it'd be best to add a section to the readme explaining the workflow for the spectral grid option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it would be good to get an explanation of how to generate the map definition file and what tool you used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also not a resolution expert, but I think ne30 is around 1 degree resolution. I also don't actually know exactly how close the resolution needs to be for ESMF to be able to make a scripgrid file to define the transition. BTW I used ESMF (which is the regridding backend to xesmf) to define the grid file map definition using one of its command line prompts, I'll add the details in the README.
So for some reason I wasn't allowed to upload there... Might be todo with various aliases between email addresses and google accounts... |
Hmm, ok, thanks for trying. I can grab an |
| def make_se_regridder(weight_file, regrid_method): | ||
| weights = xr.open_dataset(weight_file) | ||
| in_shape = weights.src_grid_dims.load().data.tolist()[::-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maritsandstad I'm hitting an error here when I try and supply a weight file during the two-step process:
File "/home/glemieux/Repos/NGEET/Tools/tools-fates-landusedata/src/landusedata/regrid.py", line 59, in make_se_regridder
in_shape = weights.src_grid_dims.load().data.tolist()[::-1]
^^^^^^^^^^^^^^^^^^^^^
File "/home/glemieux/local/miniconda3/envs/landusedata-env/lib/python3.13/site-packages/xarray/core/common.py", line 306, in __getattr__
raise AttributeError(
f"{type(self).__name__!r} object has no attribute {name!r}"
)
AttributeError: 'Dataset' object has no attribute 'src_grid_dims'
I'm using the output from using the -w option from a previous non-two step run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't think that would work, you need a map file that defines both the source grid dimensions and the destination grid, but it might very well be that the code could work with other things than what I used, but then there might have to be some hooks for testing the type of weight-file that's in use... Also, if you can do the transition without the two-step regridding. That would be preferable, but I did not manage to make weight files to make that work...
Adding descriptions on how to generate intermediate regridding file and arguments to use to specify this file when running
|
Have updated README now, hope that clarifies. As for the remapping file, it is 14M, so it might be an option to just upload it to github...? What do you think @glemieux ? |
That's a good idea @maritsandstad. I've just updated the |
No description provided.