May-25-2018, 08:05 PM
Hi there,
I am working with model data and would like to be able to interpolate each model to a common model grid. This is because each models' grid resolution (based on lines of latitude and lines of longitude) is different, so in order to maintain consistency, I would need to transform a given model's resolution to a base model (let's say that the base model's name is "modelprime", so every other model would have to be converted to modelprime's resolution). Essentially, I am re-gridding. I am also working with two separate code files - one is the main code file that I am running with, and the other contains all of the necessary elements to make the grid transformation.
The goal is to create an if/else statement in order to do this, and I was told that only 3 lines of code are required. I also imported the code containing the necessary elements by using this function:
1. How do I read off of the other code file (the one that contains all of the necessary elements for the grid transformation)? Would it involve using "fct_g."?
2. How should I construct the if/else statement?
Any thoughts?
Thanks, and I would appreciate any feedback that you might have! I look forward to your responses, and I will be diligent with mine.
I am working with model data and would like to be able to interpolate each model to a common model grid. This is because each models' grid resolution (based on lines of latitude and lines of longitude) is different, so in order to maintain consistency, I would need to transform a given model's resolution to a base model (let's say that the base model's name is "modelprime", so every other model would have to be converted to modelprime's resolution). Essentially, I am re-gridding. I am also working with two separate code files - one is the main code file that I am running with, and the other contains all of the necessary elements to make the grid transformation.
The goal is to create an if/else statement in order to do this, and I was told that only 3 lines of code are required. I also imported the code containing the necessary elements by using this function:
import functions_grid as fct_gThe first line of code in the other file is this, if it helps:
def interpolate_to_model(data,lat,lon,model): # getting the new coordinates if model == 'modelprime': nc_grid = netcdf.Dataset(So, my question is two-fold
1. How do I read off of the other code file (the one that contains all of the necessary elements for the grid transformation)? Would it involve using "fct_g."?
2. How should I construct the if/else statement?
Any thoughts?
Thanks, and I would appreciate any feedback that you might have! I look forward to your responses, and I will be diligent with mine.