[MITgcm-support] Using xarray with MITgcm

Liam Brannigan liam.brannigan at misu.su.se
Fri Jan 27 02:29:32 EST 2017


Hi

I've been using the excellent Xarray package (http://xarray.pydata.org/en/stable/) to analyse netcdf outputs from the MITgcm.  

The package is very easy to use, but there is one aspect where the way the package works can conflict with the expectations of someone working with MITgcm output.  The time variable in the model is 'T', but 'T' in the package refers to a transpose operation rather than a variable.

For example, a dataset object can be created with:
import xarray as xr
ds = xr.open_dataset('state.0000000000.nc')

The X coordinate can then be accessed with either dictionary-style access:
ds['X'] 
or as an attribute
ds.X

However, reading the time coordinate as ds.T replaces the T coordinate with a transpose of the full dataset and so time should be accessed as ds['T'] or possibly renamed.  

More details can be found here:
http://stackoverflow.com/questions/41879269/xarray-dataarray-opens-as-a-dataset/41885639#41885639

Overall, I encourage everyone to try out the package (or Ryan's modified version for binary output http://xmitgcm.readthedocs.io/en/latest/), it makes a lot of the analysis easier and offers an easy route to making your analysis parallel.

Liam


________________________________________
From: mitgcm-support-request at mitgcm.org <mitgcm-support-request at mitgcm.org>
Sent: 24 January 2017 18:00
To: mitgcm-support at mitgcm.org
Subject: MITgcm-support Digest, Vol 163, Issue 18

Send MITgcm-support mailing list submissions to
        mitgcm-support at mitgcm.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mitgcm.org/mailman/listinfo/mitgcm-support
or, via email, send a message with subject or body 'help' to
        mitgcm-support-request at mitgcm.org

You can reach the person managing the list at
        mitgcm-support-owner at mitgcm.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of MITgcm-support digest..."


Today's Topics:

   1. Re: Collected output (Camille Mazoyer)


----------------------------------------------------------------------

Message: 1
Date: Tue, 24 Jan 2017 09:35:02 +0100
From: Camille Mazoyer <mazoyer at univ-tln.fr>
To: mitgcm-support at mitgcm.org
Subject: Re: [MITgcm-support] Collected output
Message-ID: <588711B6.2010907 at univ-tln.fr>
Content-Type: text/plain; charset="windows-1252"; Format="flowed"

Hi,
It seems that your script gluemncbig is not where you want.
Could you try on a terminal:

ls ~/MITgcm_c63/utils/python/MITgcmutils/scripts/gluemncbig

to verify it location?
And then, if it's not theren you can use this command to know where it is:
locate gluemncbig

What you can do is copying the script on your working directory and then
use your second command:

python gluemncbig -o a.nc mnc_test_000*/state*

Hope this will fix your problem,

Camille Mazoyer



Le 23/01/2017 21:29, rahele shafiee a ?crit :
> Hi everyone,
> I am running MITgcm model and my output format is as ?.nc? , so
> because of npx*npy=4 , I have to collecte them together. I?m trying by
> using the following commands:
>
> python ~/MITgcm_c63/utils/python/MITgcmutils/scripts/gluemncbig -o
> a.nc mnc_test_000*/state*
> or
> python gluemncbig -o a.nc mnc_test_000*/state*
>
> But I get the following error:
>
> python: can't open file
> '/home/caelinux/MITgcm_c63/utils/python/MITgcmutils/scripts/gluemncbig':
> [Errno 2] No such file or directory
>
> How can I fix it? thank you in advance for attention to this matter
> Regards Rahele
>
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support

--
------------------------------------------
Camille Mazoyer
Phd Student
Mediterranean Institute of Oceanography (MIO)
Institut de Math?matiques de Toulon (IMATH)
Universit? de TOULON
Bat X - CS 60584
83041 TOULON cedex 9
France
tel: +33.4.94.14.24.50
Email: mazoyer at univ-tln.fr
http://mio.pytheas.univ-amu.fr/
http://imath.fr/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mitgcm.org/pipermail/mitgcm-support/attachments/20170124/a4792bfc/attachment.html>

------------------------------

_______________________________________________
MITgcm-support mailing list
MITgcm-support at mitgcm.org
http://mitgcm.org/mailman/listinfo/mitgcm-support


End of MITgcm-support Digest, Vol 163, Issue 18
***********************************************



More information about the MITgcm-support mailing list