trondkr / model2roms

Model2roms is a Python toolbox for creating forcing files required to run Regional Ocean Modeling System (ROMS)
MIT License
58 stars 34 forks source link

Where to define model GRD and input data? #5

Closed AndresSepulveda closed 5 years ago

AndresSepulveda commented 5 years ago

Hi,

Where do I define the output grid (from my model), and the input data, from GLORYS?

trondkr commented 5 years ago

Hi Andres,

First of all, make sure you have the latest version downloaded as some bugs have been fixed over the last few weeks. Most of the settings are done in configM2R.py. There you can define your name for your model grid (output, in my case A20):

self.outgrid = "A20"

The path to the grid is in the function: def defineromsgridpath(self):

This method defines a dictionary of model grids using self.outgrid as the key. So, in my case it retrieves the A20 grid since that is the key I provided. The forcing data path for SODA3 is done in

def defineforcingdatapath(self):

This is also a dictionary that returns the path to the dataset depending on the key self.indatatype

Let me know if that helps. T

På 15. mai 2019 kl. 12:23:48, Andres Sepulveda (notifications@github.com) skrev:

Hi,

Where do I define the output grid (from my model), and the input data, from GLORYS?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/trondkr/model2roms/issues/5?email_source=notifications&email_token=AA32XA23GJDYHJFQ7XST4RLPVRPMJA5CNFSM4HNGIFEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUAEFMA, or mute the thread https://github.com/notifications/unsubscribe-auth/AA32XA5OONFOD4T4DHFM4HDPVRPMJANCNFSM4HNGIFEA .

trondkr commented 5 years ago

I should also have mentioned that if you are using GLORYS you would need to add a line to suggest the path. To find those data egg, something like:

def defineforcingdatapath(self): return {'SODA3': "/Volumes/DATASETS/SODA3.3.1/OCEAN/", 'NORESM': "/cluster/projects/nn9412k/A20/FORCING/RCP85_ocean/", 'GLORYS': "/cluster/projects/nn9412k/glorys/", 'WOAMONTHLY': "/Users/trondkr/Projects/is4dvar/createSSS/"}[self.indatatype]

På 15. mai 2019 kl. 12:33:57, Trond Kristiansen (me@trondkristiansen.com) skrev:

Hi Andres,

First of all, make sure you have the latest version downloaded as some bugs have been fixed over the last few weeks. Most of the settings are done in configM2R.py. There you can define your name for your model grid (output, in my case A20):

self.outgrid = "A20"

The path to the grid is in the function: def defineromsgridpath(self):

This method defines a dictionary of model grids using self.outgrid as the key. So, in my case it retrieves the A20 grid since that is the key I provided. The forcing data path for SODA3 is done in

def defineforcingdatapath(self):

This is also a dictionary that returns the path to the dataset depending on the key self.indatatype

Let me know if that helps. T

På 15. mai 2019 kl. 12:23:48, Andres Sepulveda (notifications@github.com) skrev:

Hi,

Where do I define the output grid (from my model), and the input data, from GLORYS?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/trondkr/model2roms/issues/5?email_source=notifications&email_token=AA32XA23GJDYHJFQ7XST4RLPVRPMJA5CNFSM4HNGIFEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUAEFMA, or mute the thread https://github.com/notifications/unsubscribe-auth/AA32XA5OONFOD4T4DHFM4HDPVRPMJANCNFSM4HNGIFEA .

AndresSepulveda commented 5 years ago

Thanks,

I downloadad daily records from

GLOBAL_ANALYSIS_FORECAST_PHY_001_024-TDS

but I am not sure where to define the input file name. Is it in configM2R.py ?

trondkr commented 5 years ago

The filenames are created in the file 'forcingfilenames.py'. I have only tested with monthly GLORYS files so you may have to edit the code a little to get daily files to work correctly, but in theory, it should be straightforward. As you can see the function for GLORYS is called 'getGLORYSfilename(confM2R, year, month, myvar)' and takes year and month as input to create the monthly filename. You would have to add the day to make this correct. In the future, I will re-write the function so that all of the files in a given directory is read using MFDataset or xarray so individual filenames would not have to be created,